lp(1) General Commands Manual lp(1)
NAME
lp, lpalt, cancel - print/alter/cancel requests on an LP destination
SYNOPSIS
[file ...]
id
[id ...] [dest ...]
DESCRIPTION
The command queues files for printing. The command changes information in a queued request. The command deletes a queued request.
lp Command
The command arranges for the named files, file ..., and associated information (collectively called a request) to be queued for output to a
destination in the LP (line printer) subsystem. The process is called printing, regardless of the actual output device.
associates a unique identifier with each request and writes it to standard output, using the message:
The request ID is which can be used later to alter, cancel, or find the status of the request (see and below, and lpstat(1)).
For example, in the following message,
the request ID is
lp Options and Arguments
recognizes the following options and arguments. The keyletter options can be specified in any order. The file ... names must be last.
file ... Print each named file. If no file names are specified, standard input is assumed. The hyphen symbol also specifies stan-
dard input and can be intermixed on the command line with file names. If more than one is specified, all but first are
ignored. Files are printed in the same order in which they are specified. A maximum of 832 file names can be specified.
Copy the named files to LP subsystem spooling directories.
Normally, the files are linked into a spool directory. The ownership and mode of the linked files remain unchanged. If the
option is given, or linking is not possible (perhaps because the files do not reside on the same filesystem as that of the
spooling directory), the files are copied into the spool directories. The ownership and mode of the copies are set to allow
read and write access to owner and read access to group only.
If the files are linked rather than copied, any changes made to the named files after the request is made but before it is
printed will be reflected in the printed output. Standard input is always copied instead of linked.
Select dest as the printer or class of printers that is to do the printing. If dest is a printer, the request will be printed only
on that specific printer. If dest is a class, the request will be printed on the first available printer that is a member
of the class. Under certain conditions (printer unavailability, file space limitation, etc.), requests for a specific dest
might not be accepted (see accept(1M) and lpadmin(1M)).
If the option is omitted, dest is taken from the environment variable If that variable is unset or empty, dest is taken from
the environment variable If that variable is unset or empty, the default queue is used. If there is no default queue, or
default queue exists but is empty or has invalid destination entry, or is set but invalid, is set but invalid, issues an
error message and the request is not queued. Printer and class names and the default queue are defined by your LP subsystem
administrator (see lpadmin(1M) and lpstat(1)).
Send a mail message (see
mail(1)) to the user after the request has been printed. By default, no mail is sent upon normal completion of the print
request.
Print number copies of the output. If illegal number of copies is specified with this option, the default number of copies is 1.
Specify a printer-dependent
option. You can specify several printer options by repeating the option. For information about the options that are avail-
able for a printer supported on your system, see the interface script for the printer name in the directory.
Set the priority of the print request.
priority must be in the range 0 (lowest priority) to 7 (highest priority). The priority is used by the scheduler to select
the next spooled file for the targeted printer or class of printers. If the priority is less than the fence, the minimum
priority set for the printer, the print request is deferred until the fence is lowered or the priority is raised. The
default for a printer queue is the default priority set by the or command (see lpadmin(1M) and lpsched(1M)). The default
for a class queue is the highest default priority among printers in the class.
Suppress standard output messages from
such as "". Error messages are still displayed on standard error.
Print title on the banner page of the output. The maximum length of the title is 79 bytes. title of length greater than 79 bytes
is truncated to 79 bytes.
Write a message to the user's terminal after the request has been printed.
If the user is not logged in, or if the user has denied messages to his terminal (see mesg(1)), or (for remote printing) if
(see rlpdaemon(1M)) is not running on the user's local system, mail will be sent instead.
lpalt Command
The command alters a request made by a previous command, if it is not currently printing. (To requeue a currently printing request, use
the command (see enable(1)) to stop the printer.)
lpalt Options
recognizes the following options and arguments, which can be specified in any order. Blanks are not permitted between a keyletter and its
argument.
id Specifies the request to be altered. id is a request ID returned by or
Requeue the request to the named printer or class
dest. A new unique request ID is written to standard output.
Alter only local requests.
Send mail upon normal completion of the print request.
Change the number of copies to
number.
Specify a printer-dependent
option. You can specify several printer options by repeating the option. All options from previous and commands for this
request ID are deleted.
Change the request's priority to
priority.
Suppress standard output messages from
such as "". Error messages are still displayed on standard error.
Change the title on the banner page of the output.
Write a message to the user's terminal after the request has been printed.
If the user is not logged in or if the user has denied messages to his terminal (see mesg(1)) or (for remote printing) if
(see rlpdaemon(1M)). is not running on the user's local system, mail will be sent instead.
cancel Command
The command cancels requests that were made with the command, even if they are currently printing.
The cancellation of a request that is currently printing frees the printer to print its next available request.
cancel Options and Arguments
recognizes the following options and arguments, which can be specified in any order. Blanks are not permitted between a keyletter and its
argument. When cancel is used with a mix of different options and arguments, it will operate first on id ..., next on dest ..., next on
next on and finally on irrespective of the order in which the options and arguments are specified in the command line.
id ... Specifies one or more requests to be canceled. id is a request ID returned by or
dest ... Specifies one or more printers or printer classes. If a or option is not specified, cancel the request that is currently
printing on each dest. In this case, dest must be a printer, not a class. If a or option is specified, specify the desti-
nation on which to perform the corresponding cancel operation. In this case, dest can be a printer or a class.
Remove all requests the user owns on each
dest, or if dest is not specified and option is specified, remove all requests the user owns on all destinations in the sys-
tem. The owner of a request is determined by the user's login name and the host name of the machine where the command was
invoked.
Empty the spool queue of each
dest, or if dest is not specified and option is specified, empty the spool queue of all destinations in the system. Only
users with appropriate privileges can use this option.
Cancel only local requests.
Remove all requests belonging to
user on each dest, or if dest is not specified and option is specified, remove all requests belonging to user on all desti-
nations in the system. You can repeat the option to specify more users. Only users with appropriate privileges can use
this option.
Force cancel to act on all destinations in the system.
Printing Overview
A printer can print requests from one or two destination queues: its own private queue and an optional class queue, which can serve one or
more printers. The destination queues are set up with the command. The command places a printing request into a printer or class destina-
tion queue as directed by a user. The scheduler directs the requests from the destination queues to the printers. The and commands con-
trol whether can place requests in the destination queues. The and commands control whether can send a queued request to a printer. If a
printer has two queues and one queue is rejecting requests, users can still direct requests to the other destination queue and have the
requests printed. reports the current status of the destination queues and the scheduler. See enable(1), lpstat(1), accept(1M), and lpad-
min(1M).
EXTERNAL INFLUENCES
Environment Variables
determines the locale to use for the locale categories when both and the corresponding environment variable (beginning with do not specify
a locale. If is not set or is set to the empty string, a default of "C" (see lang(5)) is used.
determines the locale to use to override any values for locale categories specified by the setting of or any environment variables begin-
ning with
determines the locale for interpretation of sequences of bytes of text data as characters (e.g., single- verses multibyte characters in
arguments and input files).
determines the language in which messages are displayed.
determines the output device or destination. If the environment variable is not set, the environment variable is used. The option takes
precedence over
determines the output device or destination. If the and environment variables are not set, the default queue is used. The option and the
environment variable takes precedence over
If any internationalization variable contains an invalid setting, the commands behave as if all internationalization variables are set to
"C". See environ(5).
International Code Set Support
Single- and multibyte character code sets are supported.
RETURN VALUE
Exit values are:
Successful completion.
Error condition occurred.
EXAMPLES
For a laserjet printer named configured with an interface script that defines the option to cause the printer to print in a compressed
mode, use the following command to print with compressed print on
can be used at the end of a pipeline to print the results of a previous command. It is commonly used with the command (see pr(1)) to print
formatted output. For a default printer, to format file into pages and print three copies of it:
WARNINGS
A remote print request can be canceled only from the system from which the the original command was issued, and if the restrict cancel fea-
ture (see lpadmin(1M)) is enabled for the specified printer, a request belonging to this printer can be canceled only by administrator or
the user who requested it.
A remote print request can be altered only from the system from which the the original command was issued, and only by administrator or the
user who requested it. The remote system will ignore this alter request if the request is being printed.
For a remote system, cannot change dest and priority.
The information on destination queues and print requests are maintained in and files under directory. These files should not be directly
read by any application other than the LP subsystem, because the format of data stored in these files may change in future.
FILES
Directory of spooler configuration data
Directory of active LP device interface scripts
Directory of model and font file directories
Directory of spooler log files
Directory of LP spooling files and directories
SEE ALSO
enable(1), lpstat(1), mail(1), slp(1), accept(1M), lpadmin(1M), lpana(1M), lpsched(1M), rcancel(1M), rlp(1M), rlpdaemon(1M), rlpstat(1M).
STANDARDS CONFORMANCE
lp(1)