[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 3


lpr Command

The lpr command includes information for lpr on a POWER-based platform and the System V Print Subsystem lpr on an POWER-based and Itanium-based platforms.

lpr Command on POWER-based Platform

Purpose

Enqueues print jobs.

Syntax

lpr [ -f ] [ -g ] [ -h ] [ -j ] [ -l ] [ -m ] [ -n ] [ -p ] [ -r ] [ -s ] [ -P Printer ] [ -# NumberCopies ] [ -C Class ] [ -J Job ] [ -T Title ] [ -i [ NumberColumns ] ] [ -w Width ] [ File ... ]

Description

The lpr command uses a spooling daemon to print the named File parameter when facilities become available. If no files are specified, the lpr command reads from standard input.

Flags


-# Number Produces multiple copies of output, using the Number variable as the number of copies for each file named.
-C Class Specifies the print Class as the job classification on the burst page.
-f Uses 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.
-h Suppresses printing of the burst page.

Note: The default is to print a header page and not a trailer page.
-i [Number] Indents output Number spaces. If the Number variable is not given, eight spaces are used as the default.
-j Specifies that the message Job number is: nnn, where nnn is the assigned job number, be displayed to standard output. This occurs only if the job is submitted to a local print queue.
-J Job Prints the Job variable as the job name on the burst page. Normally, the lpr command uses the name of the first file.
-l (Lowercase L) Uses a filter which allows control characters to be printed.
-m Sends mail upon completion of spooling.
-n Uses a filter which formats files containing ditroff (device-independent troff) data.
-P Printer Forces output to the Printer variable. If this flag is not specified, the following conditions occur:
  • If a default exists, the lpr command uses the default printer.
  • If the LPDEST environment variable is set, then lpr uses the value specified by the LPDEST variable. If set, this value is always used, even if the PRINTER variable is also set.
  • If the PRINTER variable is set and no LPDEST variable is set, then lpr uses the value specified by the PRINTER environment variable.

    Note: Any destination command line options override both the LPDEST and the PRINTER environment variables.
-p Uses the pr command to format the file (lpr -p is very much like pr | lpr).
-r Removes the file upon completion of spooling.
-s Prints from the files specified on the command line rather than trying to copy them (so large files can be printed). This means the data files should not be modified or removed until they have been printed. Note that this flag only works on the local host (files sent to remote printer hosts are copied anyway), and only with named data files. It does not work if the lpr command is at the end of a pipeline.
-T Title Uses the Title variable instead of the file name for the title used by the pr command.
-w Number Uses the Number variable as the page width for the pr command.

Examples

  1. To print three copies of the files new.index.c, print.index.c, and more.c, enter:
    lpr -#3 new.index.c print.index.c more.c
    Prints three copies of the new.index.c file, three copies of the print.index.c file, and three copies of the more.c file.
  2. To print three copies of the concatenation of three files new.index.c, print.index.c, and more.c, enter:
    cat new.index.c print.index.c more.c | lpr -#3
  3. To print Operations on the burst page, followed by file new.index.c, enter:
    lpr -C Operations new.index.c
    This replaces the system name (the name returned by host name) with Operations on the burst page.
  4. To queue the MyFile file and return the job number, enter:

    lpr -j MyFile
    

Files


/usr/sbin/qdaemon Queuing daemon.
/etc/qconfig Queue configuration file.
/etc/qconfig.bin Digested, binary version of the /etc/qconfig file.
/var/spool/lpd/qdir/* Queue requests.
/var/spool/lpd/stat/* Information on the status of the queues.
/var/spool/qdaemon Temporary copies of enqueued files.

Related Information

The lpd command, lpq command, lprm command, pr command, qdaemon command.

The qconfig file.

Starting a Print Job in AIX 5L Version 5.1 System User's Guide: Operating System and Devices.

Printers, Print Jobs and Queues Overview for Users in AIX 5L Version 5.1 System User's Guide: Operating System and Devices.

Printer Overview for System Management in the AIX 5L Version 5.1 Guide to Printers and Printing.

Spooler Overview for System Management in the AIX 5L Version 5.1 Guide to Printers and Printing.

lpr Command on POWER-based and Itanium-based Platforms

Note: This is a System V Print Subsystem command.

Purpose

(BSD) Sends a job to the printer.

Syntax

/usr/bin/lpr [ -P printer] [ -# copies] [ -C class] [ -J job] [ -T title] [ -i [indent] ] [ -w cols] [ -r] [ -m] [ -h] [ -s] [ -filter_option] [file ... ]

Description

The lpr command forwards printer jobs to a spooling area for subsequent printing as facilities become available. Each printer job consists of copies of each file you specify. The spool area is managed by the line printer spooler, lpsched. lpr reads from the standard input if no files are specified.

lp is the preferred interface.

Command-line options cannot be combined into a single argument as with some other commands. The command:

   lpr -fs

is not equivalent to

   lpr -f -s

Placing the -s flag first, or writing each option as a separate argument, makes a link as expected.

lpr -p is not precisely equivalent to pr | lpr. lpr -p puts the current date at the top of each page, rather than the date last modified.

Fonts for troff and T[E]X reside on the printer host. It is not possible to use local font libraries.

lpr objects to printing binary files.

If userA uses su to become userB and uses /usr/bin/lpr, then the printer request will be entered as userB, not userA

Flags

-P printer
Send output to the named printer. Otherwise send output to the printer named in the PRINTER environment variable, or to the default printer, lp.

-# copies
Produce the number of copies indicated for each named file. For example:

   lpr -#3 index.c lookup.c

produces three copies of index.c, followed by three copies of lookup.c. On the other hand,

   cat index.c lookup.c | lpr -#3

generates three copies of the concatenation of the files.

-C class
Print class as the job classification on the burst page. For example,

   lpr -C Operations new.index.c

replaces the system name (the name returned by ``hostname'') with Operations on the burst page, and prints the file new.index.c.

-J job
Print job as the job name on the burst page. Normally, lpr uses the first file's name.

-T title
Use title instead of the file name for the title used by pr.

-i[indent]
Indent output indent <Space> characters. Eight <Space> characters is the default.

-w cols
Use cols as the page width for pr.

-r
Remove the file upon completion of spooling, or upon completion of printing with the -s flag.

-m
Send mail upon completion.

-h
Suppress printing the burst page.

-s
Use the full pathnames (not symbolic links) of the files to be printed rather than trying to copy them. This means the data files should not be modified or removed until they have been printed. This flag only prevents copies of local files from being made. Jobs from remote hosts are copied anyway. The -s flag only works with named data files; if the lpr command is at the end of a pipeline, the data is copied to the spool.

filter_option
The following single letter options 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.

-p
Use pr to format the files (lpr -p is very much like pr | lpr).

-l
Print control characters and suppress page breaks.

-t
The files contain troff (cat phototypesetter) binary data.

-n
The files contain data from ditroff (device independent troff).

-d
The files contain data from tex (DVI format from Stanford).

-g
The files contain standard plot data as produced by the routine plot for the filters used by the printer spooler.

-v
The files contain a raster image. The printer must support an appropriate imaging model such as PostScript in order to print the image.

-c
The files contain data produced by cifplot.

-f
Interpret the first character of each line as a standard FORTRAN carriage control character.

If no filter_option is given (and the printer can interpret PostScript), the string `%!' as the first two characters of a file indicates that it contains PostScript commands.

These filter options offer a standard user interface, and all options may not be available for, nor applicable to, all printers.

 

Files

/usr/lib/lp/lpsched
System V line printer spooler

/var/spool/lp/tmp/*
directories used for spooling

/var/spool/lp/tmp/system/*-0
spooler control files

/var/spool/lp/tmp/system/*-N
(N is an integer and > 0) data files specified in `*-0' files

Error Codes

lpr: printer: unknown printer
The printer was not found in the LP database. Usually this is a typing mistake; however, it may indicate that the printer does not exist on the system. Use lpstat -p to find the reason.

lpr: error on opening queue to spooler
The connection to lpsched on the local machine failed. This usually means the printer server started at boot time has died or is hung. Check if the printer spooler daemon /usr/lib/lpsched is running.

lpr: printer: printer queue is disabled
This means the queue was turned off with

/usr/etc/lpc disable printer

to prevent lpr from putting files in the queue. This is normally done by the system manager when a printer is going to be down for a long time. The printer can be turned back on by a privileged user with lpc.

lpr: Can't send message to the LP print service

lpr: Can't establish contact with the LP print service
These indicate that the LP print service has been stopped. Get help from the system administrator.

lpr: Received unexpected message from LP print service
It is likely there is an error in this software. Get help from system administrator.

lpr: There is no filter to convert the file content
Use the lpstat -p -l command to find a printer that can handle the file type directly, or consult with your system administrator.

lpr: cannot access the file
Make sure file names are valid.

Related Information

The lpc command, lpq command, lprm command, and troff command.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]