6pm: Eliminate Print Dialogs with Terminal Direct Printing

As we move into the evening hours, we're going to step away from the traditional printer dialog box and delve into printing directly from the terminal with the lpr command.

What does this article replace?

This guide serves as a replacement for the standard GUI-based print dialogs in applications like Word or PDF viewers. Instead of clicking through menus and options, you'll be able to send your print job directly from your terminal.

How long will it take to set up?

Navigating the terminal and understanding the basic lpr command should take you around 20-30 minutes. Getting comfortable with terminal-based printing will be a breeze once you understand the basics.

2 out of 5 stars

Difficulty Rating:

Bypassing print dialogs and sending your files straight to the printer from the terminal? That's a task with a difficulty level of 2 out of 5!

Step 1: Navigate to the directory containing your document

Use the "cd" command followed by the directory path to navigate to the location of the document you wish to print.

cd /path/to/your/file

Step 2: Confirm the document is in the directory

Use the "ls" command to list all the files in the current directory. Make sure the document you want to print is listed.

ls

Step 3: Print the document

If the document is in the directory, you can print it using the "lpr" command followed by the document's name.

lpr filename

Replace "filename" with the name of your document.

If you want to print to a specific printer, you can specify it by using the "-P" option followed by the printer's name:

lpr -P printername filename

Step 4: Check your printer

Your printer should now start printing the document. If it doesn't, ensure that it's properly connected, powered on, and loaded with paper and ink or toner.

Additional information: List of printers

If you don't know the name of your printer, you can use the "lpstat -p -d" command to list all available printers:

lpstat -p -d

This command will output a list of printers installed on your system and their status. The default printer will also be indicated.

Considerations

Remember, you might need appropriate permissions to print documents from the terminal, and the printer must be correctly set up on your macOS.


Congratulations! You've just printed your first document directly from your Terminal. You're no longer dependent on the GUI print dialog box for printing tasks. You're streamlining your tasks with the efficiency of terminal commands.