[ Team LiB ] Previous Section Next Section

Using Printing Commands

The following sections describe how to use lp to submit requests from a command line. 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. The lp command has many options that can modify the printing process, as summarized in Table 89 on page 400. For a complete list of options, see the lp(1) manual page.

Printing to the Default Printer

When the LP print service is set up with a default printer, users can submit print requests without typing the name of the printer. Type lp filename and press Return. The file specified is placed in the print queue of the default printer, and the request ID is displayed.

The following example prints the /etc/passwd file.


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



Printing to a Printer by Name

Regardless of whether 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 an individual printer, type lp -d printer-name filename and press Return. The file specified is placed in the print queue of the destination printer, and the request ID is displayed.

The following example prints the /etc/passwd file on the printer acorn.


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

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


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



Requesting Notification When a File Has Been Printed

When you submit a large file to be printed, you may want the LP print service to notify you when printing is complete. You can request that the LP print service notify you either by an e-mail message or by a message to your console window.

To request e-mail notification, use the -m option when you submit the print request. Type lp -m filename and press Return.

To request that a message be written to your console window, use the -w option when you submit the print request. Type lp -w filename and press Return.

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 by the -n option to the lp command. The print request is considered as one print job, and only one banner page is printed if banner printing is enabled. To request multiple copies, type lp -n number filename and press Return.

The following example prints four copies of the /etc/passwd file.


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



Determining Printer Status

Use the lpstat command to find out about the status of the LP print service. You can check on the status of your own jobs in the print queue, determine which printers are available for you to use, or determine request IDs of your jobs if you want to cancel them.

The Status of Your Print Requests

To find out the status of your own spooled print requests, type lpstat and press Return. A list of the files that you have submitted for printing is displayed.

In the following example, on the system pine, one file is queued for printing to the printer pinecone.


pine% lpstat
pinecone-10             fred       1261   Mar 12 17:34 on pine
pine%

The lpstat command displays one line for each print job, showing the request ID followed by the name of the user who spooled the request, the output size in bytes, and the date and time of the request.

Availability of Printers

To find out which printers are configured on your system, type lpstat -s and press Return. The status of the scheduler is displayed, followed by the default destination and a list of the systems and printers that are available to you.

In the following example, on the system elm, the scheduler is running, the default printer is pinecone, and two network printers are available.


elm% lpstat -s
scheduler is running
system default destination: pinecone
system for pinecone: pine
system for acorn: oak
elm%



Display of All Status Information

The -t option for lpstat gives you a short listing of the status of the LP print service. To display a short listing of all status information, type lpstat -t and press Return. All available status information is displayed.

In the following example, no jobs are in the print queue. When files are spooled for printing, the status of those print requests is also displayed.


elm% lpstat -t
scheduler is running
system default destination: tom
system for slw2: bertha
system for slw1: bertha
device for tom: /dev/term/b
slw2 accepting requests since Thu May 11 11:01:54 EDT 2000
slw1 accepting requests since Sat May 27 16:26:38 EDT 2000
tom accepting requests since Sat Jun 3 14:25:41 EDT 2000
printer slw2 is idle. enabled since Thu May 11 11:01:55 EDT 2000. available.
printer slw1 is idle. enabled since Thu May 27 16:26:38 EDT 2000. available.
printer tom is idle. enabled since Sat Jun 3 14:25:41 EDT 2000. available.
character set usascii
character set english
character set finnish
character set japanese
character set norwegian
character set swedish
character set germanic
character set french
character set canadian_french
character set italian
character set spanish
character set line
character set security
character set ebcdic
character set apl
character set mosaic
elm%

The -l option for lpstat, when used with one of the other options, gives you a long listing of the status of the LP print service. To display a long listing of all status information, type lpstat -tl and press Return. All available status information is displayed.

In the following example for the same system, additional information is displayed. When files are spooled for printing, the status of those print requests is also displayed.


{:44} lpstat -tl
scheduler is running
system default destination: tom
system for slw2: bertha
system for slw1: bertha
device for tom: /dev/term/b
slw2 accepting requests since Thu May 11 11:01:54 EDT 2000
slw1 accepting requests since Sat May 27 16:26:38 EDT 2000
tom accepting requests since Sat Jun 3 14:25:41 EDT 2000
printer slw2 is idle. enabled since Thu May 11 11:01:55 EDT 2000. available.
        Content types: any
        Printer types: unknown
        Description:
        Users allowed:
                 (all)
        Forms allowed:
                (none)
        Banner not required
        Character sets:
                 (none)
        Default pitch:
        Default page size:

printer slw1 is idle. enabled since Sat May 27 16:26:38 EDT 2000. available.
        Content types: simple
        Printer types: unknown
        Description: Located in ia lab
        Users allowed:
                 (all)
        Forms allowed:
                (none)
        Banner not required
        Character sets:
                 (none)
        Default pitch:
        Default page size:

printer tom is idle. enabled since Sat Jun 3 14:25:41 EDT 2000. available.
        Form mounted:
        Content types: PS
        Printer types: la100
        Description: hi
        Connection: direct
        Interface: /usr/lib/lp/model/standard
        After fault: continue
        Users allowed:
                 (all)
        Forms allowed:
                (none)
        Banner required
        Character sets:
                usascii
                english
                finnish
               japanese
              norwegian
                swedish
               germanic
french
        canadian_french
                italian
                spanish
                   line
               security
                 ebcdic
                    apl
                 mosaic

        Default pitch: 10 CPI 6 LPI
        Default page size: 132 wide 66 long
(More information not shown in this example)



Display of Status for Printers

You can request printer status information for individual printers by using the -p option to lpstat. This option shows whether the printer is active or idle, when it was enabled or disabled, and whether it is available to accept print requests.

To request status for all printers on a system, type lpstat -p and press Return. In the following example, two printers are idle, enabled, and available, as shown in the following example. If one of those printers had jobs in the print queue, those jobs would also be displayed.


elm% lpstat -p
printer pinecone is idle. enabled since Sat Jan  1 18:20:22 PST 2000.
 available.
printer acorn is idle. enabled since Thu Mar  2 15:53:44 PST 2000. available.
elm%

To request status for an individual printer by name, type lpstat -p printer-name and press Return.

Display of Printer Characteristics

To see all of the characteristics for a printer, use the -p option together with the -l (long) option to lpstat. This command can be especially useful for finding the printer type and content type.

To show characteristics for all printers on a system, type lpstat -p -l and press Return. A table shows all the configuration information that is used by the LP print service for each printer.

In the following example, all the fields are blank except for the content type and the printer type of the printer pinecone.


elm% lpstat -p pinecone -l
printer pinecone is idle. enabled since Sat Jan 1 18:20:22 PST 2000.
 available.
        Content types: PS
        Printer types: PS
        Description:
        Users allowed:
                 (all)
        Forms allowed:
                (none)
        Banner not required
        Character sets:
                 (none)
        Default pitch:
        Default page size:
elm%



Summary Table of lpstat Options

You can request different types of printing status information by using the lpstat command. Table 97 summarizes the frequently used options for the lpstat command. Use these options individually or combine them in any order on the command line. When you combine options, use a space between options and repeat the dash (-). For example, to show a long list of status for an individual printer, type lpstat -p printer-name -l and press Return. See the lpstat(1) manual page for a complete list of options.

Table 97. Summary of Frequently Used Options to the lpstat Command

Option

Description

-a

Accept. Show whether print destinations are accepting requests.

-c

Class. Show classes and their members.

-d

Destination. Show default destination.

-f

Forms. Show forms.

-o

Output. Show status of output.

-p [ list][-D][-l]

Printer/description/long list. Show status of printers.

-r

Request. Request scheduler status.

-R

Show position of job in the queue.

-S

Sets. Show character sets.

-s

Status. Show status summary.

-u [ username]

User. Show requests by user.

-v

Show devices.

Cancelling a Print Request

Use the cancel command to cancel a print request while it is in the queue or while it is printing. To cancel a request, you need to know its request ID. The request ID always includes the name of the printer, a dash, and the number of the print request. When you submit the print request, the request ID is displayed. If you do not remember your request ID, type lpstat and press Return. Only the user who submitted the request or someone logged in as root or lp can cancel a print request.

Cancelling a Print Request by ID Number

To cancel a print request, type cancel request-ID and press Return. A message is displayed telling you that the request is cancelled. The next job in the queue begins printing.

In the following example, two print requests are cancelled.


elm% cancel pinecone-3 pinecone-4
request "pinecone-3" cancelled
request "pinecone-4" cancelled
elm%



Cancelling by Printer Name a File That Is Currently Printing

You can also cancel just the job that currently is printing (if you were the submitter) by typing the printer name in place of the request ID. Type cancel printer-name and press Return. A message is displayed telling you that the request is cancelled. The next job in the queue begins printing.

In the following example, the currently printing job has been cancelled.


elm% cancel pinecone
request "pinecone-3" cancelled
elm%

As system administrator, you can log in as root or lp and cancel the currently printing job by using the printer name as the argument for the cancel command.

    [ Team LiB ] Previous Section Next Section