LPR

Section: User Commands (1)
Updated: 21 March 1991
Index Return to Main Contents
 

NAME

lpr - ``standalone'' interface to a remote BSD printer spooler  

SYNOPSIS

lpr [ -job-option ... ] [ -file-option ... ] [ filename ... ]
lprm [ -Pprinter ] [ - ] args...
lpq [ -Pprinter ] [ -l ] args  

DESCRIPTION

This version of lpr is an interface to a remote BSD UNIX-style printer spooler that allows a user of a non-BSD UNIX system to print files on printers attached to a server that supports the BSD print spooler protocol.

When filenames are supplied on the command line, lpr prints the named files. If no filenames appear, standard input is printed according to the supplied options.

lprm removes the jobs specified in args from the remote print queue. The jobs must have been queued from the local host. args consist of some combination of user names or job numbers. If no args are supplied, the currently active job is deleted. The argument ``-'' is interpreted to mean ``delete all print jobs queued by this user,'' or if invoked by root, ``delete all print jobs queued from this host.''

lpq prints a listing of the jobs queued for that particular printer. The -l option prints a more verbose listing.  

ENVIRONMENT

lpr requires that the LPD_SERVER environment variable contain the name of a printer server to which files are spooled. If this variable does not exist, an error message is printed.  

OPTIONS

Options fall into two general categories: job options and file options. The former class of options affects an entire print job. The latter class affects only specific files and can be overriden for subsequent files. For example, it is possible to print a troff file and a plain text file in the same print job.

Options that require arguments can be specified with or without intervening space between the option and the argument. Thus, either -Pprinter or -P printer will work.  

Job options

These options specify parameters that affect the entire print job. These include:

-Cjobclass
Names the job class, which will appear on the job banner page. By default this is set to the local hostname.
-Jjobtitle
Names the job title, which will appear on the job banner page when printed. By default this is the name of the first file named on the command line.
-h
Tells the printer server to not print the banner page.
-m
When the print job completes, have the printer server send a mail message to the person who submitted the job. This requires that your machine be able to receive mail addressed to your-user-name@your-host-name and that the print server be able to get it there.
-Pprinter
specifies to which printer (of those attached to the printer server) output will be sent.
-qprinter
The -q option is synonymous with the -P option. This option is intended for use with VMS systems that cannot distinguish -P from -p. Since -p has another meaning, -q is used on VMS to select the printer. VMS users can also type -Pprinter within double quotes.
-r
specifies that the named files are to be removed after being successfully transmitted to the remote printer spooler.
-debug
Show messages sent to and from the server on the standard error output. Not for the faint-of-heart.
 

File options

These options specify parameters that are particular to one or more of the files to be printed. These options pertain to any files that appear to the right of the option on the command line, but they may be overriden by specifing a different option between files.

Only one of the file-type options (-d, -f, -g, -l, -n, -o, -p, -t, and -v) apply to any given file. Subsequent use of any of these options specifies the type of each file that appears to the right of the option, until another file-type option appears.

In the absence of any file-type options, lpr tries to figure out what kind of file is to be printed. It can currently recognize TEX DVI files, as well as C/A/T (``classic'') troff(1) and PostScript files. If the particular kind of file is not recognized, lpr assumes the file is an ordinary text file.

-#number
Specifies the number of copies of each file to print. Default is to print one copy of each file.
-d
Files that follow this option are device-independent (DVI) files such as might be produced by TEX.
-f
Tells lpr to expect files in FORTRAN output format, where the first character of each line determines how to handle the ``printer carraige'' after each line (SPACE=go to next line, ``+''=overprint, etc.)
-g
Files that follow this option are expected to be in V7 UNIX plot(5) format. (Very few spoolers support this format.)
-l
Files that follow this option are ordinary text files, but which may contain embedded control characters. (Some printer spoolers reject files which contain too many control characters; this option overrides that feature in order to allow users to make use of printer specific features that require use of non-printable characters.)
-n
Tells lpr to expect files in device-independent troff (ditroff) format. (Many spoolers do not support this format.)
-o
Tells lpr to expect PostScripttm files. This generally requires that the printer itself speak PostScript. Furthermore, many printer spoolers do not grok -o, but do accept PostScript files submitted as ``normal text'' files, interpreting them as PostScript programs rather than ordinary text files.
-p
Tells lpr that subsequent files are ordinary text files, which should be printed with page breaks and headers.
-t
Tells lpr to expect files generated for a C/A/T phototypesetter, such as are generated by old or ``classic'' troff.
-v
Tells lpr to expect Versatec raster-format files, or files in the printer's native format, whatever that is.
 

DIAGNOSTICS

LPD_SERVER environment variable is not set
The environment variable LPD_SERVER must be set to the name of the printer server.
bind: cannot bind to privileged port
Either no privileged ports are available (highly unlikely), or lpr is not installed as a privileged program. Tell your system manager to read the installation instructions again.
can't find network address for server
An attempt to determine the network address of the printer server failed. The server must be listed in the Internet name server, your system's /etc/hosts file, or in the NIS hosts database, depending on which mechanism your system uses for translating host names to network addresses.
filename is a TeX .dvi file, assuming -d
The named file begins and ends with the magic numbers used by TEX DVI files, and will therefore be interpreted as such instead of spewing garbage to the printer.
filename is a C/A/T troff output file, assuming -t
The file begins with the magic number generated by C/A/T (``classic'') troff(1), and will therefore be interpreted as such.
filename is a UNIX library archive -- ignoring it
lpr refuses to print library archive files, since these usually contain non-printable data.
filename is a compressed file -- ignoring it
The named file has been compressed with compress(1), and cannot be directly printed by lpr. Either use uncompress(1) to restore the original file, or pipe the file through zcat(1).
skipping zero length file filename
lpr optimizes the printing of an empty file by skipping the file entirely, thus saving trees by not printing unwanted banner pages.
filename is not a valid .dvi file
The -d option was specified, but the named file is not in DVI format.
 

BUGS

There is currently no way to delete a print job (analogous to the BSD lprm command), nor to inquire on the status of the print queue (analogus to the BSD lpq command).

The protocol used by lpr requires that it know the exact size of a file before sending it to the print spooler. In order to compute the size of a file piped to standard input, and in order to work on non-UNIX systems which cannot determine the exact size of a file, lpr reads each file into memory (counting the bytes as it goes) before sending it to the spooler. Therefore, files larger than available memory cannot be printed.

Not all printers or spoolers support all file types. There is no agreement among the various spoolers as to how to treat the -v file type.

The -T, -i, -s, and -w options of BSD lpr are not supported.

Job numbers are just independently-generated random numbers between 0 and 999, so conflicts between two jobs submitted on the same host are possible.

The VMS interface is crufty. LPR on VMS should take VMS-style options, and return a reasonable error status, but it doesn't do that yet.  

SEE ALSO

Line printer daemon protocol, RFC1179.

Documentation for the printer spooler you are using on the printer server. On BSD UNIX and some other systems, see the man pages for lpq(1), lprm(1), lpc(8), and lpd(8).


 

Index

NAME
SYNOPSIS
DESCRIPTION
ENVIRONMENT
OPTIONS
Job options
File options
DIAGNOSTICS
BUGS
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 21:51:15 GMT, February 02, 2023