Basic Command Line Printing

The lpr command is used to send a file to the print spooler. In its simplest form, lpr takes the form

lpr filename

where filename is, of course, the name of the file that should be printed. You can specify multiple filenames on the command line to cause multiple files to be printed.

A printer to send the data to can be optionally specified with the -P option. If the -P option is omitted, lpr assumes that the default printer should be used. The default printer is determined by checking the following in the order listed. The first condition that is found to be true will be used as the default printer.

  • If the PRINTER environment variable is set, lpr will use the name listed here as the default printer.

  • If the LPDEST ...

Get FreeBSD® Unleashed 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.