Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

lp - send files to a printer

&pagelevel(4)&pagelevel

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

(c - copy)

lp makes copies of the specified files when invoked and then prints these copies.

The -c option is always implicitly enabled.

-d dest

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:
If the environment variable LPDEST is set, its value is used. If LPDEST is undefined, the print job is printed on a printer in the default printer group. This is either printer group ALL or the user/terminal-specific printer group.

-n copies

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:
copies defaults to 1.

-o par

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:

  • the file is being printed on an RSO printer

  • the control-mode parameter is set to *line-mode or *physical

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

(s - silent)

Suppresses the message "request id is <request-id>" from the lp command.

-t title

(t - title)

Prints the specified title on an additional header (banner) page.

file | -

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 /var/spool/lp/temp directory.

For each file to be printed, lp issues a message in the form:

request id is <request-id> (<basename>)

<request-id> is output in the format “TSN-nnnn”, where nnnn is the BS2000 TSN.

<basename> is the basename of file, i.e. the part of the path name which comes after the last slash (“/”).

When lp reads from standard input, the message is:

request id is printer group-id (standard input)

file not specified:
lp reads from standard input.

Error

lp: can't access the file "file"
lp: Make sure file names are valid
lp: No (or empty) input files.

You do not have read permission for file, or file does not exist. The print job for file is rejected.


lp: standard input is empty
lp: request not accepted

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.


lp: Requests for destination "XYZ" aren't being accepted.
lp: Use the "lpstat -a" command to see why this destination is not accepting requests.

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.


lp: unrecognized option "-x"

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).
-d $LPDEST is the default when -d dest is not specified.

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 t1 -n 3 t2 t3
request id is TSN-153D (t1)

request id is TSN-153E (t2)

request id is TSN-1540 (t3)

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.
t1 is to be printed on printer group G001; t2 on G002:

$ lp t1

request id is TSN-234A (t1)

$ lp -dG002 t2

request id is TSN-234C (t2)

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:

$ lp -dG001 t1

$ lp -dG002 t2 

See also

cancel, lpstat