Traditional UNIX Printing


Before the advent of GUIs and WYSIWYG (page 1064) word processors, UNIX users would create documents using an editor such as vi and a typesetting markup language such as TeX or nroff/troff, convert the resulting files to PostScript using an interpreter, and send the PostScript files to the printer using lp (System V) or lpr (BSD). Red Hat Linux implements both BSD and System V command line printing utilities for compatibility: These utilities are now wrappers around the equivalent functionality in CUPS rather than core components of the printing system. The corresponding utilities are functionally equivalent; use whichever you prefer (Table 14-1).

Table 14-1. BSD and System V command line utilities

BSD/SysV

Purpose

lpr/lp

Sends job(s) to the printer.

lpq/lpstat

Displays the status of the print queue.

lprm/cancel

Removes job(s) from the print queue.


From the command line, you can print a text or PostScript file using lp:

$ lp memo.txt request id is MainPrinter-25 (1 file(s))


The preceding command adds memo.txt to the print queue of the default printer as job 25. When this printer is available, it prints the file.

You can specify a printer using the d option:

$ lp -d colorprinter graph.ps request id is ColorPrinter-26 (1 file(s))


The P option to lpr is equivalent to the d option to lp.

Without an argument, lp (and lpr) sends its standard input to the printer:

$ cat memo2.txt | lp request id is MainPrinter-27 (1 file(s))


The lpq and lpstat commands display information about the print queue:

$ lpstat MainPrinter-25          zach             13312   Sun Feb 26 18:28:38 2006 ColorPrinter-26         zach             75776   Sun Feb 26 18:28:48 2006 MainPrinter-27          zach              8192   Sun Feb 26 18:28:57 2006


Use cancel or lprm to remove jobs from the print queue. Only the owner of a print job or root can remove a job.

$ cancel 27 $ lpstat MainPrinter-25          zach             13312  Sun Feb 26 18:28:38 2006 ColorPrinter-26         zach             75776  Sun Feb 26 18:28:48 2006


Working as root, give the command cancel a or lprm to remove all jobs from the print queues.




A Practical Guide to Red Hat Linux
A Practical Guide to Red HatВ® LinuxВ®: Fedoraв„ў Core and Red Hat Enterprise Linux (3rd Edition)
ISBN: 0132280272
EAN: 2147483647
Year: 2006
Pages: 383

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net