DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

lp(C)


lp, lpr -- send requests to lineprinter

Syntax

lp [ options ] file ...

lp -i request-id [ options ]

lpr [ options ] file ...

lpr -i request-id [ options ]

Description

The first form of the lp command arranges for the named files and associated information (collectively called a request) to be printed. The files are printed in the order that they appear on the command line. lp reads from the standard input if no filenames are specified. To print files and from the standard input, specify the files before redirecting the standard input (see ``Examples'').

lp associates a unique request-id with each request and prints it on the standard output. The request-id can be used later to cancel, change, or find the status of the request. (See lpstat(C) for information about checking the status of a print request.)

The second form of lp (with the -i option) is used to change the options for a request request-id according to the options specified. The options available are the same as those for the first form of the lp command. If request-id has finished printing, the change is rejected. If request-id is already printing, it will be stopped and restarted from the beginning, unless the -P option has been given.

lpr is a link to lp. These names may be used interchangeably.

lp accepts the following options (these must precede the list of files but may be listed in any order):


-c
Make a temporary copy of the files to be printed. Any subsequent changes to the files are not printed. If -c is not specified, any changes to the file may appear in the printed output.

-d dest
Print this request using dest as the printer or class of printers. Requests for specific destinations may not be accepted under certain conditions (for example, printer not available or not capable). See accept(ADM) and lpstat(C). By default, dest is set to the value of the environment variable LPDEST if this has been set. Otherwise, the default destination for the computer system is used if one exists. Default destination names vary between systems (see lpstat(C)).

-f form-name [ -d any ]
Print the request on the form form-name. The LP print service ensures that the form is mounted on the printer. The request is rejected (see lpforms(ADM)):

The -d any option sends the request to any printer that has the requested form mounted and can handle all the other needs of the print request.


-H argument
Deal with a request (specified using the -i option) according to one of the following possible settings of argument:

hold
Do not print the request until notified. If already printing, stop the request. Other print requests will go ahead of a held request until it is resumed.

resume
Resume a held request. If it was printing when held, it will be the next request printed, unless subsequently overridden by an immediate request.

immediate
(Available only to root and lp administrators.) Print the request next. If more than one request is assigned as immediate, the requests are printed last-in first-out. If another request is currently printing on the desired printer, you must hold it to allow the immediate request to print.

-L argument
The following arguments are understood by this option:

local
Send the request to the printer attached to the terminal (see lprint(C) for more information about terminal printing).

spooler
Send the request to the default printer.

live=device
Enable printing from the standard input to the device special file or text file device. The file /usr/spool/lpd/lock must exist for this to work.
This option may not be combined with any other option.

-m
Send mail (see mail(C)) after the files have been printed. By default, no mail is sent upon normal completion of the print request.

-n number
Print number copies of the output (default is 1).

-o options
Specify one or more printer-dependent or class-dependent options as a comma-separated list. For local printers, -o can be specified more than once. For remote printers, -o can only be specified once and the list of options must be enclosed in double quotation marks (").

You can find out the options available for a printer or printer interface program using the getprops(C) command.

The standard(ADM) printer interface program recognizes the following options:


cpi=sdn|pica|elite|compressed
Print the request with the character pitch set to:

sdn
a scaled decimal number; its units are indicated by appending a letter ``i'' (for characters per inch) or ``c'' (for characters per centimeter). If no units are specified, they are assumed to be characters per inch.

pica
10 columns per inch

elite
12 columns per inch

compressed
as many columns as the printer can handle

There is no standard number of columns per inch for printers; see the terminfo(F) database for the default character pitch for your printer.

This option cannot be used with the -f option.


length=sdn
Print a request with pages that are sdn long. sdn is a scaled decimal number; its units are indicated by appending a letter ``i'' (for inches) or ``c'' (for centimeters). If no units are specified, sdn is assumed to be a absolute number of lines.

For example, length=66 indicates a page length of 66 lines, length=11i indicates a page length of 11 inches, and length=27.94c indicates a page length of 27.94 centimeters.

This option cannot be used with the -f option.


lpi=sdn
Print a request with the line pitch set to sdn. sdn is a scaled decimal number; its units are indicated by appending a letter ``i'' (for lines per inch) or ``c'' (for lines per centimeter). If no units are specified, they are assumed to be lines per inch.

This option cannot be used with the -f option.


nobanner
Do not print a banner page with a request. (The administrator can disallow this option at any time.)

nofilebreak
Do not insert a form feed between the files given if submitting a job to print more than one file.

stty=stty-option-list
Set the printer with a list of stty(C) options. You must enclose the list in single quotes if it contains whitespace.

width=sdn
Print the output of this request with a page-width of sdn. sdn is a scaled decimal number; its units are indicated by appending a letter ``i'' (for inches) or ``c'' (for centimeters). If no units are specified, sdn is assumed to be a absolute number of columns.

This option cannot be used with the -f option.

The following options to -o are recognized by other interface programs if the printer has the required capability:


ascii
allow ASCII source to be printed as PostScript by filtering it through /usr/spool/lp/bin/text2post

cdn
select condensed characters

double
select double sided printing

dq
select draft quality printing

land
select landscape printing

land2
select alternate landscape printing

lower
select the lower paper feed tray

lm=n
set the left margin to column n

lq
select letter quality printing

manual
select the manual feed tray

nlq
select near letter quality printing

port
select portrait printing

postscript
select PostScript printing; note that the printer interface scripts can auto-detect PostScript source files that begin with the sequence ``%!'' or ``<Ctrl>D%!''

raw
select raw printing; needed to print PostScript files on certain PostScript printers

rm=n
set the right margin to column n

upper
select the upper paper feed tray


-P page-list
Print the page(s) specified in page-list. This option can be used only if there is a filter available to handle it; otherwise, the print request will be rejected.

The page-list may consist of range(s) of numbers, single page numbers, or a combination of both. The pages will be printed in ascending order.


-q priority-level
Assign priority-level to this request in the printing queue. The values of priority-level range from 0, the highest priority, to 39, the lowest priority. If a priority is not specified, the default for the print service is used, as assigned by the printer administrator.

-R
Remove file after sending it.

-s
Suppress messages from lp such as ``request id is ...''.

-S character-set [ -d any ]
Print this request using the specified character-set. The request is rejected if a form has been specified that requires a different character-set.

If the print-wheel specified is not one listed by the administrator as acceptable for the printer involved in this request, the request is rejected unless the print wheel is already mounted on the printer.

The -d any option sends the request to any printer that can select the character set and can handle all the other needs of the request.


-S print-wheel [ -d any ]
Print this request using the specified print-wheel. The request is rejected if a form has been specified that requires a different print-wheel.

If the character-set specified is not one defined in the terminfo database for the printer (see terminfo(F)) or is not an alias defined by the administrator, the request is rejected.

The -d any option sends the request to any printer that has the print wheel mounted and can handle all the other needs of the request.


-t title
Print title on the banner page of the output. The default is no title.

-T type [ -r ]
Tell the print service to print the request on a printer that supports files of the specified content type. If no printer accepts this type directly, a filter will be used to convert the file contents into an acceptable type. If the -r option is specified, a filter will not be used.

The request is rejected:


-w
Write a message on the terminal after the files have been printed. Mail is sent instead if the user has logged out or the terminal cannot be written to (because mesg(C) has been set with the n option).

-y mode[,mode ...]
Print a request according to the printing modes listed. The allowed values for mode are locally defined. This option can be used only if there is a filter available to handle it; if there is no filter, the print request will be rejected.

Locale settings

lp passes the values of the locale to the LP print service; the date on the banner pages is printed in the language defined by the environment variables LC_ALL, LC_TIME, and LANG in decreasing order of precedence.

For example, if LC_ALL is defined as french, the date is printed in French; if LC_ALL is undefined, LC_TIME is english, and LANG is french, the date is printed in English.

If none of LC_ALL, LC_TIME, or LANG is set, the default locale of the system on which the request was submitted is used (defined in /etc/default/lang).

Defaults file

The defaults file /etc/default/lpd contains the following variables:

BANNERS
controls the number of banner pages that are printed to identify each request. Its value is normally set to either 0 or 1 (default). The printer administrator can override this value for any printer using the -b option to lpadmin(ADM).

PRINTJOB_LAG
configures the lag time between printing remote jobs. (By default, this lag is 30 seconds.) Setting this value to a few seconds can increase system load significantly, while setting it to zero can interfere with attempts to administer print jobs remotely.

Handling raster-type files

To print from an SCO OpenServer Release 5 server, the server must have a printer defined that can accept raster-type input. This is done using the command:

/usr/lib/lpadmin -pprinter -Traster

If a printer on the server cannot handle raster types directly, a filter must be defined to convert files to a format that the printer can handle, for example, PostScript(TM). This can be done by the following:

/usr/lib/lpfilter -fraster -
Input types: raster
Output types: simple
Printer types: any
Printers: any
Filter type: fast
Command: command to convert raster file

To print the file, type the following from the client:

lp -d printer -Traster raster_filename

See lpd(ADMN) for details of raster file support.

Exit values

lp returns the following values:

0
all files were processed successfully

>0
no output device was available, or an error occurred

Examples

Print all C source files from the current directory downwards that have been accessed within the last two days; use the printer named laser:

find . -depth -name '*.c' -atime -2 -print | lp -c -d laser

Print the files f1 and f2, together with text read from the standard input, on the default printer:

lp -c f1 f2 <<%%
The contents of this here-document will also be printed.
%%

Send request laser-1066 to the new destination laser2:

lp -i laser-1066 -d laser2

Hold request prt-1812 in the queue:

lp -i prt-1812 -H hold

Release request prt-1812 for printing:

lp -i prt-1812 -H resume

Print the file foo, without a banner and with 60 lines to a page, on a local printer:

lp -o nobanner -o length=60 -d local foo

Print the file foo, without a banner and with 60 lines to a page, on a remote printer:

lp -o "nobanner,length=60" -d remote foo

Warning

For printers that take mountable print wheels or font cartridges, your request is printed with whatever print wheel or font happens to be mounted if you do not use the -S option. Use the lpstat -p -l command to see what print wheels are available.

For printers that have selectable character sets, your request is printed with the standard character set if you do not use the -S option.

Limitations

Printers for which requests are not being accepted will not be considered when the destination is any. (Use the lpstat -a command to see which printers are accepting requests.) On the other hand, if a request is destined for a class of printers and the class itself is accepting requests, all printers in the class will be considered, regardless of their acceptance status, as long as the printer class is accepting requests.

You can print a raster file only if both your client and the print server are either of the following:

Files


/usr/spool/lp/*

/etc/default/lpd

See also

accept(ADM), cancel(C), enable(C), getprops(C), locale(M), lpadmin(ADM), lpd(ADMN), lpfilter(ADM), lpforms(ADM), lpsched(ADM), lpstat(C), lpusers(ADM), mail(C), standard(ADM), terminfo(F), write(C)

Standards conformance

lp is conformant with:

ISO/IEC DIS 9945-2:1992, Information technology - Portable Operating System Interface (POSIX) - Part 2: Shell and Utilities (IEEE Std 1003.2-1992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003