With lp you can:
have files printed on a printer (print job)
select the RSO printer or printer group on which a print job is to be run
have a header page printed
modify printer options for print jobs
lp associates a print job with each named file. If no file is specified, the data to be printed is expected from the standard input. The files are printed in the order in which they are listed. lp assigns a unique job number (request ID) to each print job and writes this number on the standard output. This number can be used later to cancel or abort a print job or to have status information on the print job displayed.
Currently printing jobs and jobs which have already been submitted, but not yet started, can be aborted or cancelled with cancel.
Information on the status of print jobs can be displayed with lpstat.
Syntax
lp[ -c][ -d dest][ -n copies][ -s][ -o par] ...[ -t title][ datei|-...] |
No option specified The specified files are printed on any free printer in the default printer group (normally ALL).
(c - copy) lp makes copies of the specified files when invoked and then prints these copies. The -c option is always implicitly enabled.
Chooses dest as the RSO printer or printer group that is to do the printing. If the printer group includes more than one printer, the job (or request) will be printed on the first available printer in the group. dest can be given as the name of any RSO printer or printer group. The names of legal RSO printer or printer groups can be listed with the command lpstat -a. -d dest not specified:
This option defines how many copies of the files are to be printed. copies can be any integer that falls within an effective range from 1 to 99. -n copies not specified:
par can be used to set any or all of the print parameters line-spacing, control-char-pos and control-mode or selects the print parameters for the output of PostScript files. If these parameters are to be used in combination, the -o par option must be specified for each parameter. The parameters can have the following values: line-spacing = 1 | 2 | 3 | *s[td] | *e[bcdic] | *a[sa] | *i[bm] control-char-pos = *std | <int 1..2040> control-mode = *pa[ge-mode] | *li[ne-mode] | *lo[gical-mode] | *ap[a] | *ph[ysical] postscript | ps If the print parameters line-spacing, control-char-pos or control-mode are specified, the values are passed through to the corresponding operands of the BS2000 PRINT-DOCUMENT command (DOCUMENT-FORMAT), see manual "BS2000 Commands" [11]. If there are control characters in the file being printed (such as \f for form feed), they will be interpreted only if both of the following conditions are met:
If control-mode is not specified, any control characters in the file will be represented as non-printing characters (smudge characters). When the postscript (or ps) parameter is specifed, the BS2000 print parameters for outputting PostScript files are set. The other printer parameters are then not meaningful. The printer selected must be able to print PostScript files.
(s - silent) Suppresses the message "
(t - title) Prints the specified title on an additional header (banner) page.
Name of the file to be printed. More than one file may be specified. If you name a number of files, they are printed in the order in which you list them. If you use a dash (-) as the name for file, lp reads from standard input and creates a temporary file in the For each file to be printed, lp issues a message in the form:
< < When lp reads from standard input, the message is:
file not specified: |
Error
You do not have read permission for file, or file does not exist. The print job for file is rejected.
You omitted the file name or used a dash (-) instead, but you have not entered anything from standard input. The job has consequently been rejected.
The printer group XYZ that you specified for dest when calling lp with the -d option is not a valid RSO printer or printer group. It may also be that the environment variable LPDEST is assigned the value XYZ. Unless explicitly specified otherwise, this value will then be substituted for dest for all lp calls.
An invalid option, -x in this case, has been used. |
File
/var/spool/lp/temp/* Temporary file lp creates when reading from standard input. |
Variable
LPDEST Name of a printer group (class of printers). |
Locale
The following environment variables affect the execution of lp: LANG Provide a default value for the internationalization variables that are unset or null. If LANG is unset of null, the corresponding value from the implementation-specific default locale will be used. If any of the internationalization 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 internationalization 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), the classification of characters as upper- to lower-case, and the mapping of characters from one case to the other. LC_MESSAGES Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. LC_TIME Determine the format and contents of date and time strings displayed in the lp banner page, if any. NLSPATH Determine the location of message catalogs for the processing of LC_MESSAGES. |
Example 1
Three files, t1, t2 and t3, are to be printed. Three copies each of files t2 and t3 are required.
lp issues a message for each file to be printed. |
Example 2
Two files, t1 and t2, are to be printed. Two printer groups, G001 and G002, are defined. The value of the environment variable LPDEST is G001.
Since the environment variable LPDEST is set to G001, the printer group need not be specified for t1. If LPDEST were undefined or assigned some value other than G001, the command would be written as follows:
|
See also
cancel, lpstat |