Printing From The Command Line

Printing is not an involved process whether you click on a button in a GUI or type commands from the command line. This section explains how to print, cancel, and view print jobs from the command line, assuming you have a properly configured printer connected to your system.

The lpr command, followed by a filename, sends that specified file to the print queue. For example, lpr foo.txt prints the foo.txt file.

To view the jobs waiting in the print queue, type lpq at the command line. Type lpq, and you will see information similar to this:

active root  389  foo.txt

In this example, 389 is the job number.

You can cancel jobs in the queue by typing lprm followed by the print job number displayed when you use the lpq command. To cancel this print job, type lprm 389 and press [Enter].