Printing
Compared to computers, printers are slow devices, and because they are commonly shared, it is generally undesirable for users to send jobs directly to them. Instead, most operating systems provide commands to send requests to a print daemon [2] that queues jobs for printing, and handles printer and queue management. Print commands can be handled quickly because printing is done in the background when the needed resources are available.
Printing support in Unix evolved into two camps with differing commands but equivalent functionality, as summarized in Table 4-2. Commercial Unix systems and GNU/Linux usually support both camps, whereas BSD systems offer only the Berkeley style. POSIX specifies only the lp command.
Table 4-2. Printing commands
Berkeley | System V | Purpose |
|---|---|---|
lpr | lp | Send files to print queue |
lprm | cancel | Remove files from print queue |
lpq | lpstat | Report queue status |
Here is an example of their use, first with the Berkeley style:
$lpr -Plcb102 sample.psSend PostScript file to print queue lcb102 $lpq -Plcb102Ask for print queue status lcb102 is ready and printing Rank Owner Job File(s) Total Size active jones 81352 sample.ps 122888346 bytes $lprm -Plcb102 81352Stop the presses! Kill that huge job
and then with the System V style:
$lp -d lcb102 sample.psSend PostScript file to print queue lcb102 request id is lcb102-81355 (1 file(s)) $lpstat -t lcb102Ask for print queue status printer lcb102 now printing lcb102-81355 $cancel lcb102-81355Whoops! ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access