NAME
lp — send files to
a printer
SYNOPSIS
lp |
[-c][-d
dest][-n
copies][-msw][-o
option]... [-t title]
[file ...] |
DESCRIPTION
The lp utility copies the input files to
an output destination in an unspecified manner. The default output
destination should be to a hardcopy device, such as a printer or microfilm
recorder, that produces non-volatile, human-readable documents. If such a
device is not available to the application, or if the system provides no
such device, the lp utility will exit with a
non-zero exit status.
The actual writing to the output device may occur some time after
the lp utility successfully exits. During the
portion of the writing that corresponds to each input file, the
implementation guarantees exclusive access to the device.
The lp utility associates a
unique request ID
with each request.
Normally, a banner page is produced to separate and
identify each print job. This page may be suppressed by
implementation-dependent conditions, such as an operator command or one of
the -o
option values.
OPTIONS
The lp utility supports the XBD
specification,
Utility
Syntax Guidelines .
The following options are supported:
- -c
- Exit only after further access to any of the input files is no longer
required. The application can then safely delete or modify the files
without affecting the output operation. Normally, files will not be
copied, but will be linked whenever possible. If the
-coption is not given, then the user should be careful not to remove any of the files before the request has been printed in its entirety. It should also be noted that in the absence of the-coption, any changes made to the named files after the request is made but before it is printed will be reflected in the printed output. On some systems,-cmay be on by default. - -d dest
- Specify a string that names the destination (dest). If dest is a printer,
the request will be printed only on that specific printer. If dest is a
class of printers, 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, and so on), requests for specific
destinations need not be accepted; see lpstat(1) .
Destination names vary between systems; see lpstat(1) .
If
-dis not specified, and neither the LPDEST nor PRINTER environment variable is set, an unspecified destination is used. The-ddest option takes precedence over LPDEST , which in turn takes precedence over PRINTER . Results are undefined when dest contains a value that is not a valid destination name. - -m
- Send mail (see mailx(1) ) after the files have been printed. By default, no mail is sent upon normal completion of the print request.
- -n copies
- Write copies number of copies of the files, where copies is a positive decimal integer. The methods for producing multiple copies and for arranging the multiple copies when multiple file operands are used are unspecified, except that each file will be output as an integral whole, not interleaved with portions of other files.
- -o option
- Specify printer-dependent or class-dependent option s. Several such option
s may be collected by specifying the
-ooption more than once. - -s
- Suppress messages from
lpsuch as "request id is ...". - -t title
- Write title on the banner page of the output.
- -w
- Write a message on the user's terminal after the files have been printed. If the user is not logged in, then mail will be sent instead.
OPERANDS
The following operand is supported:
- file
- A pathname of a file to be output. If no file operands are specified, or
if a file operand is "-", the standard input will be used. If a
file operand is used, but the
-coption is not specified, the process performing the writing to the output device may have user and group permissions that differ from that of the process invokinglp.
STDIN
The standard input will be used only if no file operands are specified, or if a file operand is "-". See the INPUT FILES section.
INPUT FILES
The input files must be text files.
ENVIRONMENT VARIABLES
The following environment variables affect the execution of
lp :
LANG- Provide a default value for the internationalisation variables that are
unset or null. If
LANGis unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined. LC_ALL- If set to a non-empty string value, override the values of all the other internationalisation variables.
LC_CTYPE- Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments and input files).
LC_MESSAGES- Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informative messages written to standard output.
LC_TIME- Determine the format and contents of date and time strings displayed in
the
lpbanner page, if any. LPDEST- Determine the destination. If the
LPDESTenvironment variable is not set, thePRINTERenvironment variable will be used. The-ddest option takes precedence over LPDEST . Results are undefined when-dis not specified andLPDESTcontains a value that is not a valid destination name. NLSPATH- Determine the location of message catalogues for the processing of LC_MESSAGES .
PRINTER- Determine the output device or destination. If the
LPDESTandPRINTERenvironment variables are not set, an unspecified output device is used. The-ddest option and theLPDESTenvironment variable takes precedence over PRINTER . Results are undefined when-dis not specified,LPDESTis unset, andPRINTERcontains a value that is not a valid device or destination name.
ASYNCHRONOUS EVENTS
Default.
STDOUT
The lp utility writes a request ID to the
standard output, unless -s is specified. The format
of the message is unspecified. This request ID can be used later to cancel
(see cancel(1) ) or find the status (see
lpstat(1) ) of the request.
STDERR
Used only for diagnostic messages.
OUTPUT FILES
None.
EXTENDED DESCRIPTION
None.
EXIT STATUS
The following exit values are returned:
CONSEQUENCES OF ERRORS
Default.
APPLICATION USAGE
The pr(1) and fold(1) utilities can be used to achieve reasonable formatting for the implementation's default page size.
A portable application can use one of the
file operands only
with the -c option or if the file is publicly
readable and guaranteed to be available at the time of printing. This is
because the standard gives the implementation the freedom to queue up the
request for printing at some later time by a different process that might
not be able to access the file.
EXAMPLES
- To print file file :
lp -c file
- To print multiple files with headers:
pr file1 file2 | lp
FUTURE DIRECTIONS
None.