Linux and Unix lpr command

Quick links

About lpr
Syntax
Examples
Related commands
Linux and Unix main page

About lpr

Submits print requests.

Syntax

lpr [ -P destination ] [ -# number ] [ -C class] [ -J job ] [ -T title ] [ -i [ indent ] ] [-1 | -2 | -3 | -4 font ] [ -w cols ] [ -m ] [ -h ] [ -s ] [-filter_option ] [ file ... ]

-P destinationThe name of the printer from which you wish to print too.
-# numberPrints a specific number of copies. Specify number as a positive integer. The default for number is 1.
-C classPrints class as the job classification on the banner page of the output. Enclose class in double quotes if it contains blanks.
-J jobPrints job as the job name on the banner page of the output. Enclose job in double quotes if it contains blanks. If job is not specified, file (or in the case of multiple files, the first file specified on the command line) is printed as the job name on the banner page of the output.
-T titlePrints a title on the banner page of the output. Enclose title in double quotes if it contains
blanks. If title is not specified, file is printed on the banner page.
-i [indent]Indents the output a specific number of SPACE characters. Use indent to indicate the number of SPACE characters to be indented. Specify indent as a positive integer. Eight SPACE characters is the default.
-1 -2 -3 -4 fontMounts the specified font in the font position 1, 2, 3, or 4. Specify font as a valid font name.
-w colsPrints file with pages of a specific width. cols indicates the number of columns wide.
-mSends mail after file has printed. See mail. By default, no mail is sent upon normal completion of a print request.
-hSuppresses printing of the banner page of the output.
-sUses full pathnames (as opposed to symbolic links) to file rather than trying to copy them. This means file should not be modified or removed until it has completed printing. Option -s only prevents copies of local files from being made on the local machine. Option -s only works with specified files. If the lpr command is at the end of a pipeline, file is copied to the spool.
-filter_optionsNotifies the print spooler that file is not a standard text file. Enables the spooling daemon to use the appropriate filters to print file. 

filter_options offer a standard user interface. All options may not be available for, or applicable to, all printers.

Specify filter_option as a single character.

If filter_option is not specified and the printer can interpret PostScriptO, inserting `%!' as the first two characters of file causes file to be interpreted as PostScript.

The following filter_options are supported:

pUse pr to format the files. See pr.
lPrint control characters and suppress page breaks.
tfile contains troff (cat photo-typesetter) binary data.
nfile contains ditroff data from device independent troff.
dfile contains tex data from in DVI format from Stanford.
gfile contains standard plot data produced by plot(1B) routines.
vfile contains a raster image. printer must support an appropriate imaging model such as PostScript in order to print the image.
cfile contains data produced by cifplot.
f   Interprets the first character of each line as a standard FORTRAN carriage control character.
filenameThe name of the file which you want to print.

Examples

lpr myfile.txt

Submits the request to print myfile.txt.

Related commands

hostname
lp
lpc
lpq
lprm
lpstat
mail