LPR printing on command line

Linux
Author

Vinh Nguyen

Published

April 13, 2011

These days, with Linux distros such as Ubuntu, printing is quite easy. You can add and remove printers and print files just as easily (or even more so) compared to Windows or Mac. Sometimes I might just want to print from the command line. To do so, I make use of the lpr command.

To find out what printers are available, type:

lpstat -p -d ## from CUPS manual

This and this gives a good introduction to lpr.

lpr filename ## print file using default printer
lpr -P printername filename ## print file using the selected printer; see lpstat -p -d for list of printers
lpr -# num filename ## to print num times

openoffice -p filename.doc ## for doc files

lpr should support txt, ps, and pdf files.