02Confirm 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.
$ ls03Print the document
If the document is in the directory, you can print it using the "lpr" command followed by the document's name.
$ lpr filenameReplace "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 filename04Check 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 -dThis 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.