lp(1) lp(1)
NAME
lp, lpalt, cancel - print/alter/cancel requests on an LP printer or
plotter
SYNOPSIS
lp [-c] [-ddest] [-m] [-nnumber] [-ooption] [-ppriority] [-s]
[-ttitle] [-w] [file ...]
lpalt id [-ddest] [-i] [-m] [-nnumber] [-ooption] [-ppriority] [-s]
[-ttitle] [-w]
cancel [id ...] [printer ...] [-a] [-e] [-i] [-uuser]
DESCRIPTION
The lp command queues files for printing. The lpalt command changes
information in a queued request. The cancel command deletes a queued
request.
lp Command
The lp command arranges for the named files, file ..., and associated
information (collectively called a request) to be queued for output to
a printer or plotter in the LP (line printer) subsystem. The process
is called printing, regardless of the actual output device.
lp associates a unique identifier with each request and writes it to
standard output, using the message:
request id is dest-sequence (fileinfo)
The request ID is dest-sequence, which can be used later to alter,
cancel, or find the status of the request (see lpalt and cancel below,
and lpstat(1)).
For example, in the following message,
request id is pr47lf8e-2410 (1 file)
the request ID is pr47lf8e-2410.
lp Options and Arguments
lp recognizes the following options and arguments. The keyletter
options can be specified in any order. The file ... names must be
last. Blanks are not permitted between a keyletter and its argument.
file ... Print each named file. If no file names are specified,
standard input is assumed. The hyphen symbol (-) also
specifies standard input and can be intermixed on the
command line with file names. Files are printed in the
same order in which they are specified.
Hewlett-Packard Company - 1 - HP-UX Release 10.20: July 1996
lp(1) lp(1)
-c 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 -c option is given, or linking is
not possible (perhaps because the printer is not
physically attached to the local system or cluster),
the files are copied into the spool directories. The
ownership and mode of the copies are set to allow read
access to owner lp and group bin 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.
-ddest 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 -d option is omitted, dest is taken from the
environment variable LPDEST. If that variable is unset
or empty, the default queue is used, if one has been
defined. If there is no default queue, or LPDEST is
set but invalid, lp 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)).
-m 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.
-nnumber Print number copies of the output. The default is 1.
-ooption Specify a printer-dependent option. You can specify
several printer options by repeating the -o option.
For information about the options that are available
for a printer supported on your system, see the
interface script for the printer name in the
/etc/lp/interface directory.
-ppriority Set the priority of the print request. priority must
be in the range 0 (lowest priority) to 7 (highest
Hewlett-Packard Company - 2 - HP-UX Release 10.20: July 1996
lp(1) lp(1)
priority). The priority is used 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 lpadmin or lpfence command
(see lpadmin(1M) and lpsched(1M)). The default for a
class queue is the highest default priority among
printers in the class.
-s Suppress standard output messages from lp such as
"request id is ...". Error messages are still
displayed on standard error.
-ttitle Print title on the banner page of the output.
-w Write a message to the user's terminal after the
request has been printed. If the user is not logged in
or (for remote printing) if rlpdaemon (see
rlpdaemon(1M)) is not running on the user's local
system, mail will be sent instead.
lpalt Command
The lpalt command alters a request made by a previous lp command, if
it is not currently printing. (To requeue a currently printing
request, use the disable command (see enable(1)) to stop the printer.)
lpalt Options
lpalt 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 lp or lpalt.
-ddest Requeue the request to the named printer or class dest.
A new unique request ID is written to standard output.
-i Alter only local requests.
-m Send mail upon normal completion of the print request.
-nnumber Change the number of copies to number.
-ooption Specify a printer-dependent option. You can specify
several printer options by repeating the -o option.
All -o options from previous lp and lpalt commands for
this request ID are deleted.
Hewlett-Packard Company - 3 - HP-UX Release 10.20: July 1996
lp(1) lp(1)
-ppriority Change the request's priority to priority.
-s Suppress standard output messages from lpalt such as
"request id is ...". Error messages are still
displayed on standard error.
-ttitle Change the title on the banner page of the output.
-w Write a message to the user's terminal after the
request has been printed. If the user is not logged in
or (for remote printing) if rlpdaemon (see
rlpdaemon(1M)). is not running on the user's local
system, mail will be sent instead.
cancel Command
The cancel command cancels requests that were made with the lp
command, even if they are currently printing. At least one id or
printer must be specified.
The cancellation of a request that is currently printing frees the
printer to print its next available request.
cancel Options and Arguments
cancel 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 one or more requests. id is a request ID
returned by lp or lpalt.
printer ... Specifies one or more printers. printer is the name of
a printer, not a class. Either cancel the request that
is currently printing on each printer, or, if an -a, -
e, or -u option is specified, specify the printer on
which to perform the corresponding operation.
-a Remove all requests the user owns on each printer. The
owner is determined by the user's login name and the
host name of the machine where the lp command was
invoked.
-e Empty the spool queue of all requests for each printer.
Only users with appropriate privileges can use this
option.
-i Cancel only local requests.
-uuser Remove any requests belonging to user. You can repeat
the -u option to specify more users. Only users with
appropriate privileges can use this option.
Hewlett-Packard Company - 4 - HP-UX Release 10.20: July 1996
lp(1) lp(1)
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 lpadmin
command. The lp command places a printing request into a printer or
class destination queue as directed by a user. The lpsched scheduler
directs the requests from the destination queues to the printers. The
accept and reject commands control whether lp can place requests in
the destination queues. The enable and disable commands control
whether lpsched 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. lpstat reports the current status of the destination queues
and the scheduler. See enable(1), lpstat(1), accept(1M), and
lpadmin(1M).
EXTERNAL INFLUENCES
Environment Variables
LANG determines the locale to use for the locale categories when both
LC_ALL and the corresponding environment variable (beginning with LC_)
do not specify a locale. If LANG is not set or is set to the empty
string, a default of "C" (see lang(5)) is used.
LC_ALL determines the locale to use to override any values for locale
categories specified by the setting of LANG or any environment
variables beginning with LC_.
LC_CTYPE 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).
LC_MESSAGES determines the language in which messages are displayed.
LPDEST determines the output device or destination. If the LPDEST
environment variable is not set, the PRINTER environment variable is
used. The -d dest option takes precedence over LPDEST. Results are
undefined when -d is not specified and LPDEST contains a value that is
not a valid device or destination name.
PRINTER determines the output device or destination. If the LPDEST
and PRINTER environment variables are not set, an unspecified output
device is used. The -d dest option and the LPDEST environment
variable takes precedence over PRINTER. Results are undefined when -d
is not specified, LPDEST is unset, and PRINTER contains a value that
is not a valid device or destination name.
If any internationalization variable contains an invalid setting, the
commands behave as if all internationalization variables are set to
"C". See environ(5).
Hewlett-Packard Company - 5 - HP-UX Release 10.20: July 1996
lp(1) lp(1)
International Code Set Support
Single- and multibyte character code sets are supported.
RETURN VALUE
Exit values are:
0 Successful completion.
>0 Error condition occurred.
EXAMPLES
For a HP2934A printer named lp2, configured with an interface script
that defines the -c option to cause the printer to print in a
compressed mode, use the following command to print myfile with
compressed print on lp2:
lp -dlp2 -oc myfile
lp can be used at the end of a pipeline to print the results of a
previous command. It is commonly used with the pr command (see pr(1))
to print formatted output. For a default printer, to format file
.profile into pages and print three copies of it:
pr .profile | lp -n3
WARNINGS
A remote print request can be altered or cancelled only by the user
who requested it, and only from the system from which the the original
lp command was issued.
If the restrict cancel feature (see lpadmin(1M)) is enabled for the
specified printer, a user can only alter or cancel requests owned by
the user.
For a remote system, lpalt cannot change dest and priority.
FILES
/etc/lp Directory of spooler configuration
data
/etc/lp/interface Directory of active LP device
interface scripts
/usr/lib/lp Directory of model and font file
directories
/var/adm/lp Directory of spooler log files
/var/spool/lp 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), mklp(1M), rcancel(1M), rlp(1M), rlpdaemon(1M),
rlpstat(1M).
Hewlett-Packard Company - 6 - HP-UX Release 10.20: July 1996
lp(1) lp(1)
STANDARDS CONFORMANCE
lp: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2
cancel: SVID2, SVID3, XPG4
Hewlett-Packard Company - 7 - HP-UX Release 10.20: July 1996