The lpr
command supports a number of options that
control formatting text, converting graphic and other file
formats, producing multiple copies, handling of the job, and
more. This section describes the options.
The following lpr
options control formatting of the
files in the job. Use these options if the job doesn't
contain plain text or if you want plain text formatted
through the pr
utility.
For example, the following command prints a DVI file (from
the TeX typesetting system) named fish-report.dvi
to the printer named bamboo
:
lpr -P bamboo -d fish-report.dvi
These options apply to every file in the job, so you can't
mix (say) DVI and ditroff files together in a job.
Instead, submit the files as separate jobs, using a
different conversion option for each job.
Note: All of these options except -p
and -T
require conversion filters installed for the destination
printer. For example, the -d
option requires the DVI
conversion filter. Section
Conversion Filters
gives details.
-c
Print cifplot files.
-d
Print DVI files.
-f
Print FORTRAN text files.
-g
Print plot data.
-i number
Indent the output by number columns; if you omit number, indent by 8 columns. This option works only with certain conversion filters.
Note: Don't put any space between the -i
and
the number.
-l
Print literal text data, including control characters.
-n
Print ditroff (device indepdendent troff) data.
Format plain text with pr
before printing. See
pr(1) for more information.
-T title
Use title on the pr
header instead of the
file name. This option has effect only when used with
the -p
option.
-t
Print troff data.
-v
Print raster data.
Here's an example: this command prints a nicely
formatted version of the ls
manual page on the
default printer:
zcat /usr/share/man/man1/ls.1.gz | troff -t -man | lpr -t
The zcat
command uncompresses the source of the
ls
manual page and passes it to the troff
command, which formats that source and makes GNU troff
output and passes it to lpr
, which submits the job to
the LPD spooler. Because we used the -t
option to
lpr
, the spooler will convert the GNU troff output
into a format the default printer can understand when it
prints the job.
The following options to lpr
tell LPD to handle the
job specially:
Produce a number of copies of each file in the job instead of just one copy. An administrator may disable this option to reduce printer wear-and-tear and encourage photocopier usage. See section Restricting Multiple Copies .
This example prints three copies of parser.c
followed by three copies of parser.h
to the
default printer:
lpr -#3 parser.c parser.h
Send mail after completing the print job. With this option, the LPD system will send mail to your account when it finishes handling your job. In its message, it will tell you if the job completed successfully or if there was an error, and (often) what the error was.
Don't copy the files to the spooling directory, but make symbolic links to them instead.
If you're printing a large job, you probably want to use this option. It saves space in the spooling directory (your job might overflow the free space on the filesystem where the spooling directory resides). It saves time as well since LPD won't have to copy each and every byte of your job to the spooling directory.
There is a drawback, though: since LPD will refer to the original files directly, you can't modify or remove them until they have been printed.
Note: If you're printing to a remote printer, LPD
will eventually have to copy files from the local host
to the remote host, so the -s
option will save
space only on the local spooling directory, not the
remote. It's still useful, though.
Remove the files in the job after copying them to the
spooling directory, or after printing them with the
-s
option. Be careful with this option!
These options to lpr
adjust the text that normally
appears on a job's header page. If header pages are
suppressed for the destination printer, these options have
no effect. See section
Header Pages
for information about
setting up header pages.
Replace the hostname on the header page with text. The hostname is normally the name of the host from which the job was submitted.
Replace the job name on the header page with text. The job name is normally the name of the first file of the job, or ``stdin'' if you're printing standard input.
Do not print any header page. Note: At some sites, this option may have no effect due to the way header pages are generated. See Header Pages for details.