Printing via the command line
- Get a list of available printers: lpstat -p
- Print a file: lpr [-Pprinter] filename
if -Pprinter is omitted the file is send to the default printer.
- Get the queue status: lpq [-a] [-Pprinter]
-a lists all active jobs and -Pprinter lists the queue for the indicated printer.
- lprm -Pprinter jobnumber : dequeues a printjob.
- Passing options to the printer: lpr [-Pprinter] -o option filename
options available for most printers are:
- -o landscape : rotate 900
- -o job-sheets=none to suppress the banner page
- -o page-ranges=1-4,7,9-12 (or similar) : select pages to print
- -o number-up=[1,2,4] : allows to print 1, 2 or 4 pages on one sheet of paper
- -o prettyprint : puts a header at the top of each
page with the page number, job
title (usually the filename), and the date. C and C++ keywords are highlighted, and
comment lines are italicized
In addition most printers have more options, like duplexing, transparency options etc.
These options are used exactly as the one listed above.
To see the options available for a given printer:
lpoptions -p printer -l
if -p printer is omitted, options are shown for the default printer.
- Set default printer : lpoptions -d printer
- Setting personal preferences for a printer: lpoptions [-pprinter] -o option
sets the desired options for the indicated printer for later use.
- Printer instances:
For example: lpoptions -p ps01/duplex -o Duplex=DuplexNoTumble
Then: lpr -P ps01/duplex filename
will print in duplex mode to ps01.
- Options can be removed via: lpoptions -x
More information can be found at:
http://phylog.phy.ornl.gov:631/sum.html
Commonly used options for some printers
- To print transparencies:
Each printer that is capable of printing transparencies
has a special transparency queue
associated with it.
For example:
- lpr -Ppsjet1_trans filename - print transparencies on psjet1
- lpr -Ppsjet1 filename - print a paper copy on psjet1
The following printers can print transparencies: psjet1, jet6000, jet6000b,
jet6025, jet6010
- To use duplex printing:
ps01: lpr -o Duplex=DuplexNoTumble