The ability to manage your printers and print queues isn't very helpful until you actually need to print files . LPI 102 covers the lpr command to send jobs to the lpd daemon for printing. You can also use a combination of lpr with mpage to manipulate your print jobs to print multiple pages to a single sheet of paper.
lpr
lpr [options
] [files
]
Send files
or standard input to a print queue. A copy of the input source is placed in the spool directory under /var/spool/lpr until the print job is complete.
-#
number
Send number
copies of the print job to the printer.
Instead of copying a file to the print spooling area, make a symbolic link to the file instead, thereby eliminating transfer time and storage requirements in /var/spool/lpr for very large files.
name
Specify the print queue name
. In the absence of -P
, the default printer is queried.
Print the file /etc/lilo.conf on the default print queue:
# lpr /etc/lilo.conf
Print a manpage by piping to lpr's standard input:
# man -t 5 printcap | lpr
Disable a print queue:
# lpc disable lp
Then attempt to print three copies of a file to the disabled queue as superuser:
# lpr -#3 /etc/lilo.conf
Success, despite the disabled printer queue. Now try as a regular user:
$ lpr -#3 ~/resume.txt
lpr: Printer queue is disabled
As expected, normal users can't print to the disabled queue.
On the Exam
You must be familiar with lpr and its use with both files and standard input. Also remember that lpr doesn't send data to the printer, but to lpd, which handles sending it to the printer.
mpage
mpage [options
] [files
]
The mpage command reads plain text (or PostScript) files and manipulates the text size to fit multiple print pages on single sheets of paper. This tool requires a PostScript printer to print the results.
-#
number (1, 2, 4, or 8)
Prints number
of normal pages per sheet. mpage supports printing 1, 2, 4, or 8 pages per sheet.