lpr

Print on a line printer

Syntax:

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

Runs on:

Neutrino

Options:

-#num
The number of copies desired of each file named. For example:
lpr -#3 foo.c bar.c more.c 
      

results in three copies of the file foo.c, followed by three copies of the file bar.c, etc. On the other hand:

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

gives three copies of the concatenation of the files. Often a site disables this feature to encourage use of a photocopier instead.

-[1234]font
Specifies a font to be mounted on font position i.
-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) to be replaced on the burst page by EECS, and the file foo.c to be printed.

-c
The files are assumed to contain data produced by cifplot.
-d
The files are assumed to contain data from tex.
-f
Use a filter that interprets the first character of each line as a standard FORTRAN carriage control character.
-g
The files are assumed to contain standard plot data.
-h
Suppress the printing of the burst page.
-i [numcols]
Indent the output. If the next argument is numeric (numcols), it's used as the number of blanks to be printed before each line; otherwise, 8 characters are printed.
-J job
The job name to print on the burst page. Normally, the first file's name is used.
-l
Use a filter that lets control characters be printed and suppresses page breaks.
-m
Send mail upon completion.
-n
The files are assumed to contain data from ditroff.
-Pprinter
Force output to a specific printer. Normally, the default printer is used (site dependent), or the value of the environment variable PRINTER is used.
-p
Use pr to format the files.
-r
Remove the file upon completion.
-s
Use symbolic links.
-T title
The title name for pr (instead of the filename).
-t
The files are assumed to contain data from troff.
-U user
The user name to print on the burst page, also for accounting purposes. This option is honored only if the real userid is daemon (or that specified in the /etc/printcap file instead of daemon), and is intended for those instances where print filters wish to re-queue jobs.
-v
The files are assumed to contain a raster image.
-wnum
Use num as the page width for pr.
filename
The name of the file to print.

Description:

The lpr utility uses the spooling daemon lpd to print the named files when facilities become available. If no names appear, the standard input is assumed.


Note: This utility needs to have the setuid ("set user ID") bit set in its permissions. If you use mkefs, mketfs, or mkifs on a Windows host to include this utility in an image, use the perms attribute to specify its permissions explicitly, and the uid and gid attributes to set the ownership correctly.

Diagnostics

If a user other than root prints a file and spooling is disabled, lpr prints a message saying so and won't put jobs in the queue.

If a connection to lpd on the local machine can't be made, lpr says that the daemon can't be started.

Environment variables:

PRINTER
An alternate default printer.
DONT_USE_LINK_UNLINK
Use rename() instead of link() or unlink().

Caveats:

If you try to spool a file that's too large, it's truncated.

If the lpd daemon has any problems (e.g. it can't find the spool file), it might print some diagnostics in its log file.

See also:

lpd, lprc, lprq, lprrm, pr, /etc/printcap

Printing chapter of the Neutrino User's Guide