Printing Files in Unix at UW CSE
Like everything else in Unix, printing is most commonly done at the
command line. Here are some common printing-related commands and options.
As always, to find more information, use man or
info.
- lpr
- Your plain-vanilla line printer. lpr can
handle plain-text passably well, but you should only use lpr when
printing PostScript (i.e. .ps) files. Some options to pass to
lpr:
- -P<printer name> - Specifies which
printer to print to.
- -h - Removes the header page (the almost-blank sheet
of paper with your CSE login)
- -Z<option> - Add special printing
options. The only really useful option is duplex,
which prints double-sided.
Examples:
- lpr -Pps231 -h cse341-research-paper.ps
Prints the PostScript file
cse341-research-paper.ps to the printer in 231,
omitting the header page.
- lpr -Pps232 -Zduplex -h BSTree.cc
Prints the C++ file BSTree.cc double-sided
to the printer in 232, omitting the header page.
- enscript
- A fancier, more powerful way to print files. Do
NOT use enscript to print anything but
plain-text! Printing (for example) PostScript files using
enscript will probably jam the printer with 200 pages of random
characters. Useful options include:
- -P<printer name> - Specifies which
printer to print to.
- -h - Removes the header page (the almost-blank sheet
of paper with your CSE login)
- -D<option> - Send a printer-specific
command to enscript. To print double-sided, try
-DDuplex:true -DTumble:true.
- -2 - Print two columns per page. Really useful with
the -r option.
- -r - Rotate each page 90 degrees, so that pages are
in "landscape" mode.
- -C or --line-numbers - Print line numbers
(useful for printing code!).
- -G or --fancy-header - Print a pretty
("gaudy") per-page banner.
- -B or --no-header - Do not print any
per-page banner.
- --word-wrap - Wrap too-long lines along
word-boundaries.
Examples:
- enscript -Pps329 -h cse-341-research-paper.ps
Jams the printer in 329 with your header-less
PostScript file.
- enscript -DDuplex:true -DTumble:true -Pps232 -hG2r
BSTree.hh BSTree.cc
Prints the C++ files BSTree.hh and
BSTree.cc double-sided to the printer in 232,
omitting the header page. Each page has a pretty banner,
and is split into two columns. Text is printed in
landscape mode.
- enscript -Pps329 -2r -C -B
--word-wrap HelloWorld.java
Prints the Java file HelloWorld.java
single-sided to the printer in 329. Text is rotated and
printed in two columns, and lines are numbered. No banner
is printed on each page. Lines are wrapped intelligently.
- lpq
- Ever wonder who's the jerk who's printing War and Peace when
your project is due in 10 minutes? Check the print queue to find out the
status of all the print jobs (including jobs sent from
Windows!). The only option you need is:
- -P<printer name> - Specifies which
printer to check.
- lprm
- lprm removes jobs from the print queue. In fact, since
the Windows print queue sends its files to the Unix queues, you can kill
jobs with lprm that you weren't fast enough to kill from Windows.
Useful options and arguments include:
- -P<printer name> - Specifies which
printer.
- <username> - Remove all print jobs sent
by username.
- <job numbers> - Remove print jobs
specified by job number (use lpq to get the job
numbers).
Examples:
- lprm -Pps329 joeuser
Removes all of joeuser's files waiting
to be printed in 329.
- lprm -Pps231 2 4 5
Removes jobs 2, 4, and 5 from the queue in 231.
Comments to:
hctang@cs.washington.edu
Last modified: