Printing with lpr

LPRng (as well as its predecessor from BSD) uses a binary called lpr to send print jobs to print queues. This is the equivalent of DOS's print command, but it offers greatly enhanced control over such items as banner pages, the number of times the print job will be printed, special functionality for binary files, and a slew of other options that help to control the final printouts.

The syntax for lpr is quite extensive, but in general the following syntax is used (check the man page for lpr to see all the options offered):

lpr -Pprinter [-b] file-to-print

For example, to print out the /etc/printcap file to a printer called ps, the following command can be executed:

lpr -Pps /etc/printcap

Like most Linux utilities, lpr can ...

Get Special Edition Using Linux®, Sixth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.