Posted On 2007-05-01 by FortyPoundHead
Keywords: Command Reference
Tags: Linux Commandline Linux
Views: 1482


off line print - sends a print job to the default system queue.

lpr [-Pprinter] [-#num] [-C class] [-J job] [-T title] [-U user] [-i [numcols]]
[-1234 font] [-wnum] [-cdfghlnmprstv] [name ...]

Lpr uses a spooling daemon to print the named files when facilities be­
come available. If no names appear, the standard input is assumed.

The following single letter options are used to notify the line printer
spooler that the files are not standard text files. The spooling daemon
will use the appropriate filters to print the data accordingly.

-c The files are assumed to contain data produced by cifplot(1)

-d The files are assumed to contain data from tex (DVI format from

-f Use a filter which interprets the first character of each line as
a standard FORTRAN carriage control character.

-g The files are assumed to contain standard plot data as produced
by the plot routines (see also plot for the filters used by the
printer spooler).

-l Use a filter which allows control characters to be printed and
suppresses page breaks.

-n The files are assumed to contain data from ditroff (device inde­
pendent troff).

-p Use pr(1) to format the files (equivalent to print).

-t The files are assumed to contain data from troff(1) (cat photo­
typesetter commands).

-v The files are assumed to contain a raster image for devices like
the Benson Varian.

These options apply to the handling of the print job:

-P Force output to a specific printer. Normally, the default print­
er is used (site dependent), or the value of the environment
variable PRINTER is used.

-h Suppress the printing of the burst page.

-m Send mail upon completion.

-r Remove the file upon completion of spooling. Can not be used with
the -s option, due to security concerns.

-s Use symbolic links. Usually files are copied to the spool direc­
tory. The -s option will use symlink(2) to link data files
rather than trying to copy them so large files can be printed.
This means the files should not be modified or removed until they
have been printed.

The remaining options apply to copies, the page display, and headers:

-#num The quantity num is the number of copies desired of each file
named. For example,

lpr -#3 foo.c bar.c more.c

would result in 3 copies of the file foo.c, followed by 3 copies
of the file bar.c, etc. On the other hand,

cat foo.c bar.c more.c | lpr -#3

will give three copies of the concatenation of the files. Often a
site will disable this feature to encourage use of a photocopier

Specifies a font to be mounted on font position i. The daemon
will construct a .railmag file referencing the font pathname.

-C class
Job classification to use on the burst page. For example,

lpr -C EECS foo.c

causes the system name (the name returned by hostname(1)) to be
replaced on the burst page by EECS, and the file foo.c to be

-J job Job name to print on the burst page. Normally, the first file''s
name is used.

-T title
Title name for pr(1), instead of the file name.

-U user
User name to print on the burst page, also for accounting purpos­
es. This option is only honored if the real user-id is daemon
(or that specified in the printcap file instead of daemon), and
is intended for those instances where print filters wish to re­
queue jobs.

-i [numcols]
The output is indented. If the next argument is numeric
(numcols), it is used as the number of blanks to be printed be­
fore each line; otherwise, 8 characters are printed.

-wnum Uses num as the page width for pr(1).

If the following environment variable exists, it is used by lpr:

PRINTER Specifies an alternate default printer.

/etc/passwd Personal identification.
/etc/printcap Printer capabilities data base.
/usr/sbin/lpd* Line printer daemons.
/var/spool/output/* Directories used for spooling.
/var/spool/output/*/cf* Daemon control files.
/var/spool/output/*/df* Data files specified in "cf" files.
/var/spool/output/*/tf* Temporary copies of "cf" files.

If you try to spool too large a file, it will be truncated. Lpr will ob­
ject to printing binary files. If a user other than root prints a file
and spooling is disabled, lpr will print a message saying so and will not
put jobs in the queue. If a connection to lpd(1) on the local machine
cannot be made, lpr will say that the daemon cannot be started. Diagnos­
tics may be printed in the daemon''s log file regarding missing spool
files by lpd(1).

Fonts for troff(1) and tex reside on the host with the printer. It is
currently not possible to use local font libraries.

About the Author

FortyPoundHead has posted a total of 1974 articles.


Comments On This Post

No comments on this post yet!

Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.

Your IP address is:

Before you can post, you need to prove you are human. If you log in, this test goes away.

Recent Forum Posts

SSL Now Active
dwirch posted on June 16, 2017 at about 8:40 in Site News

SSL Now Active
dwirch posted on June 13, 2017 at about 7:59 in Site News

Coding Archive?
dwirch posted on June 3, 2017 at about 12:54 in Site News

Job Spammer: Bharti Jigyasi
dwirch posted on June 2, 2017 at about 16:57 in Spammers

Coding Archive?
dwirch posted on May 25, 2017 at about 12:38 in Site News

BWASL returns
dwirch posted on May 13, 2017 at about 15:24 in Site News