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).
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. |