How do I print from the command line?

Table of Contents

Command-line options
Examining the queue
Printer aliases

The most common way of printing from a workstation is with a command-line client, such as 'lpr' or a graphical program which sends your job through 'lpr'. See the next section for a list of options to lpr which can modify your job.

Some graphical program are printing system aware and can automatically determine which printers are available and what features they support. A brief list of such programs includes GNOME applications like gedit, known as 'Text Editor', and gnumeric, the spreadsheet program, or ooffice, the cross-platform Office suite.

Command-line options

Most of our printers can handle advanced job modification options and can print non-PostScript files like PDF and JPEG without requiring manual conversion by the user. The job options allow one to specify a subset of pages to print, output order, the number of document pages printed on a single printed page, and more. To see all of these options, please refer to

Here is a partial list of options:

  • lpr filename

  • lpr -P printer filename

  • lpr -o landscape -o scaling=75 -o media=A4 filename.jpg

  • lpr -#num-copies filename

  • lpr -#num-copies -o Collate=True filename

  • lpr -o media=Letter,Transparency filename

  • lpr -o media=Letter,MultiPurpose,Transparency filename

  • lpr -o landscape filename

  • lpr -o portrait filename

  • lpr -o sides=one-sided filename

  • lpr -o sides=two-sided-long-edge filename

  • lpr -o job-sheets=classified,classified filename

  • lpr -o page-ranges=1-4,7,9-12 filename

  • lpr -o page-set=even filename

  • lpr -o outputorder=reverse filename

  • lpr -o number-up=4 filename

  • lpr -o number-up=16 filename

  • lpr -o mirror filename

  • lpr -o brightness=120 filename

  • lpr -o gamma=1700 filename

  • lpr -o cpi=17 filename

  • lpr -o lpi=8 filename

  • lpr -o columns=3 filename

  • lpr -o page-bottom=value filename

  • lpr -o prettyprint filename

  • lpr -o natural-scaling=percent filename

  • lpr -o hue=value filename

  • lpr -o saturation=percent filename

  • lpr -o blackplot filename

  • lpr -o fitplot filename

  • lpr -o penwidth=value filename

  • lpr -o raw filename

  • lpr -l filename

Examining the queue

The printing system will often enqueue, dequeue, and delivers a job to the printer before you have a chance to see that it has actually arrived on the queue. This may lead you to believe that your job hasn't printed since 'lpq' won't show your job when in fact it has already been accepted by the printer. To view a list of jobs that the printer has already received, run 'lpstat -W completed -o PRINTER' where PRINTER is where you sent your job. You can also run 'lpstat -W completed -u USERNAME' to see all jobs completed by the user USERNAME.

Printer aliases

It is possible to create a printer alias using a list of options so that if you send a job to the printer alias, it is modified by the options specified in the alias.

For instance, the command 'lpoptions -p pr1/4s -o sides=one-sided -o number-up=4' creates the printer alias pr1/4s with the options for simplex and 4-up printing. If one then sends a job to pr1/4s without any additional options, e.g. 'lpr -P pr1/4s' the job will be automatically simplexed and 4-upped. These options are saved to the file '~/.lpoptions'.

You must always specify a printer alias using the slash (/) character.