OpenWindows Advanced User's Guide

8.1 Submitting Print Requests

To print a file from the command prompt, you use the lp command to send a request to the printer to print that file. When a request is made, the LP print service places it in the queue for the printer, displays the request ID number, and then redisplays the shell prompt.

8.1.1 Submitting Print Requests to the Default Printer

When the LP print service is set up with a default printer, you can submit print requests as follows without typing the name of the printer:

$ lp filename

where filename is the name of the file you want to print.

The specified file is placed in the print queue of the default printer, and the request id is displayed.

For example, to print the /etc/passwd file, type:

$ lp /etc/passwd
request id is pinecone-8 (1 file)
$ 

See System Administration Guide, Volume II for information on how to specify a default printer.

8.1.2 Submitting Print Requests Using a Printer Name

Whether or not a default printer has been designated for your system, you can submit print requests to any printer that is configured for your system. To submit a print request to a specific printer, type the following:

$ lp -d printername filename

where printername is the name of the specific printer and filename is the name of the file you want to print.

The specified file is placed in the print queue of the destination printer, and the request id is displayed.

For example, to print the /etc/passwd file on the printer acorn, type:

$ lp -d acorn /etc/passwd
request id is acorn-9 (1 file)
$ 

If you submit a request to a printer that is not configured on your system, an information message is displayed, as shown in the following example:

$ lp -d thorn /etc/passwd
UX:lp: ERROR: Destination "thorn" is unknown to the
              LP print service.
$ 

See System Administration Guide, Volume II for information on configuring printers. See "8.2 Determining Printer Status", in this chapter, for information about how to find out which printers are available on your system.

8.1.3 Requesting Notification when Printing is Complete

When you submit a large file for printing, you may want the LP print service to notify you when printing is complete. You can request that the LP print service notify you in two ways:

To request email notification, use the -m option when you submit the print request:

$ lp -m filename

To request a message be written to your console window, use the -w option when you submit the print request:

$ lp -w filename

where filename is the name of the file you're printing.

8.1.4 Printing Multiple Copies

You can print more than one copy of a file. When you request more than one copy, the file is printed the number of times you specify using the -n option to the lp command. The print request is considered as one print job, and only one header page is printed.

Enter the following to request multiple copies:

$ lp -nnumber filename

where number is the desired number of copies and filename is the name of the file you are printing.

For example to print four copies of the /etc/passwd file:

$ lp -n4 /etc/passwd
request id is pinecone-9 (1 file)
$ 

8.1.5 Summary Table of lp Options

You can customize your print request using options to the -lp command: specifying forms, character sets, filters, titles, banners, and so forth. Table 8-1 summarizes the frequently used options for the lp command. You can use these options individually or combine them in any order on the command line. When you combine options, use a space between each option and repeat the dash (-).

For example, to specify a destination printer, request email notification, and print six copies of a file, you would enter the following:

$ lp -d printername -m -n6 filename

where printername is the name of the desired printer and filename is the name of the file you are printing.

Table 8-1 Summary of Frequently Used lp Options

Option 

Description 

-d

Destination. Specifies a destination printer by name. 

-m

Mail. Sends email to the requestor when the file has printed successfully. 

-n

Number. Specifies the number of copies to be printed. 

-t

Title. Specifies a title (printed only on the banner page) for a print request. 

-o nobanner

Option. Suppresses printing of the banner page for an individual request. 

-h

Header. Puts a header on each page of the print request. 

-c

Copy. Copies the file before printing. 

-w

Write. Writes a message to your terminal when the file has printed successfully. 

See the lp(1) man page for a complete list of options.