User Tools

Site Tools


Printing from command line

For a description of the printers available to Linux machines refer to printing

On the Linux system the printing is handled by a central print-spooler. The spooler queues, format (if necessary) and send the file to the printer. The spooler is in our case called . In the normal case the file you want to print should be a postscript-file. All our printers understand postscript and PDF. One typical format is “text”, but even a lot of other formats is possible. The spooler takes care of the file, and try to do its best to convert it to postscript before it is sent to the printer. However, in most cases, might be required that you convert the files to postscript yourself.

To print a document “” to the default printer, use


To print to another printer (copy_n in this example) use

lpr -P copy_n

See what is in the print queue

  lpq -P copy_t

Remove all your printouts from the queue

  lprm -
  lprm - -P printer


Printers that are able to print duplex, do that by default, and are flipping the page along the long edge. To print in simplex (only on one side of the paper)

  lpr -o sides=one-sided

To print on both sides and flip along the short edge

  lpr -o sides=two-sided-short-edge

To print on both sides and flip along the long edge (default)

lpr -o sides=two-sided-long-edge
  lpr -o page-ranges=4
  lpr -o page-ranges=1-8
  lpr -o page-ranges=1,3,6

Pretty printing

This option is only useful when printing text files.

Specifies that the file should be formatted with a shaded header with the date, time, job name, and page number.

  lpr -p


lpr -o prettyprint

To print two pages on each side of the paper

lpr -o number-up=2

And to get in even more on the paper

lpr -o number-up=4

You can also use 8 and 16. But can you read it?


To rotate the page 90 degrees and print it in landscape orientation

lpr -o landscape

In most cases it is better to create the file in landscape orientation.


lpr -o mirror

Might be useful if you want to print something that Leonardo D. has written.

Combining options

You can combine the options, like in the following example

lpr -P newprinter -o prettyprint -o number-up=2

Other useful utilities

ps2ps can do a lot of tricks on a postscript-file. It is used in the background of the printing system to handle many of the options above, but can be used directly on a file. ps2ps can sometimes be used to “clean up” ps or eps files originating from other systems.

gv or ghostview, is the number one program to check a ps-file before printing it. It can save many trees – but nowadays you're used to this.


it_services/mf/printing_cmdline.txt · Last modified: 2014/09/17 15:55 by florido

Accessibility Statement