lpstat Command

The lpstat command includes information for the AIX® Print Subsystem lpstat and the System V Print Subsystem lpstat.

AIX Print Subsystem lpstat Command

Purpose

Displays line printer status information.

Syntax

lpstat [ -aList ] [ -cList ] [ -d ] [ -oList ] [ -pList ] [ -r ] [ -s ] [ -t ] [ -uList ] [ -vList ] [ -W ]

Description

The lpstat command displays information about the current status of the line printer.

If no flags are given, lpstat prints the status of all requests made by the lp command.

Flags can appear in any order and can be repeated. Some flags take an optional list as a parameter. Enter the list as either a list of items separated by commas, as in lpstat -aQueue1,Queue2, or as a list of items enclosed in single or double quotes and separated either by commas or one or more spaces, as in, for example, lpstat -a"Queue1 Queue2" or lpstat -a"Queue1,Queue2" or lpstat -a'Queue1 Queue2' or lpstat -a'Queue1,Queue2'.

If you specify a flag with no parameters, all information pertaining to that flag is printed.

The display generated by the lpstat command contains two entries for remote queues. The first entry contains the client's local queue and local device name and its status information. The second entry contains the client's local queue name followed by the remote queue name. The spooling subsystem first displays remote print requests on the local queue. When the remote machine begins to process the remote print job, the status display for the print job moves to the remote queue.

When a status command communicates with a remote host, the display occasionally appears to hang while the command waits for a response from the remote machine. The command eventually times out if no connection is established between the two machines.

Flags

Item Description
-aList Provides status and job information on queues. Specifying the lpstat command with this flag is the same as specifying the enq -q -PQueue1 -PQueue2 ... command (where Queue1, Queue2, etc., are items in List).
-cList Provides status and job information on queues. Specifying the lpstat command with this flag is the same as specifying the enq -q -PQueue1 -PQueue2 ... command (where Queue1, Queue2, etc., are items in List).
-d Prints the status information for the system default destination for the lp command. Specifying the lpstat command with this flag is the same as specifying the enq -q command.
-oList Prints the status of print requests or print queues. List is a list of intermixed printer names and job numbers.
-pList Prints the status of printers.
-r Provides status and job information on queues. Specifying the lpstat command with this flag is the same as specifying the enq -A command.
-s Displays a status summary, including a list of printers and their associated devices. Specifying the lpstat command with this flag is the same as specifying the enq -A command.
-t Displays all status information, including a list of printers and their associated devices. Specifying the lpstat command with this flag is the same as specifying the enq -AL command.
-uList Prints the status of all print requests for users specified in List. List is a list of login names. Specifying the lpstat command with this flag is the same as specifying the enq -u UserName command.
-vList Prints the status of printers. The List variable is a list of printer names.
-W Displays a wide version of the status information with longer queue names, device names, and job numbers. Longer job number information is supported in AIX 4.3.2, and later. This flag cannot be used with the -t flag. If the -t flag and the -W flag are used simultaneously, the first specified flag takes precedence.

If the -W flag and -l flag are used simultaneously, the result displays the long status of the print job in the semicolon-separated format.

Exit Status

This command returns the following exit values:

Item Description
0 Successful completion.
>0 An error occurred.

Security

Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in AIX Version 7.1 Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.

Examples

  1. To display the status for all print queues, enter:
    lpstat
  2. To display the long status for all printers, enter:

    lpstat  -t

  3. To display a job number in the print queue lp0, enter:

    lpstat  -plp0

    This command displays a list similar to the following:
    Queue  Dev      Status      Job    Files      User      PP      %      Blks      CP      Rnk
    lp0    dlp0     running     39     motd       guest     10      83      12        1       1
  4. To display the status for users root, ghandi, and king, enter:

    lpstat  -u"root,ghandi,king"

  5. To display the status of all print queues in wide format for AIX 4.3.2 or later, enter:

    lpstat  -W

Files

Item Description
/var/spool/lpd/* Contains temporary copies of remote enqueued files.

Related Information

The disable command, enable command, enq command, lp command, lpr command, qchk command.

Command for checking print job status (qchk command) in AIX Version 7.1 Operating system and device management.

Printers, print jobs, and queues in AIX Version 7.1 Operating system and device management.

Print spooler in AIX Version 7.1 Operating system and device management.

System V Print Subsystem lpstat Command

Purpose

Prints information about the status of the LP print service.

Syntax

lpstat [flags] [request-ID-list]

Description

The lpstat command displays information about the current status of the LP print service. If no flags are given, lpstat displays the status of all print requests made by you. (See lp for more information.)

The command lpstat -o printername is used to list all the requests queued on the specified printer. If printername points to a remote printer (see lpadmin), then lpstat -o printername lists all the requests on the remote printer, not just those submitted locally.

Any arguments that are not flags are assumed to be request-IDs as returned by lp. The lpstat command displays the status of such requests. The flags may appear in any order and may be repeated and intermixed with other arguments. Some of the keyletters below may be followed by an optional list that can be in one of two forms:

Specifying all after any keyletter that takes list as an argument causes all information relevant to the keyletter to be displayed. For example, the command lpstat -a all lists the accepting status of all print destinations.

The omission of a list following such keyletters causes all information relevant to the keyletter to be displayed. For example, the command lpstat -a is equivalent to lpstat -a all.

There are two exceptions to the behavior of the all keyword. The first is when it is used in conjunction with the -o flag: lpstat -o all only lists requests submitted locally to remote printers. The second is when it is used with directory-enabled print queues. Use of the all keyword will only return non-directory-enabled print queues. lpstat -a list will report whether the both directory-enabled and non-directory-enabled print queues in list are accepting requests. For the -a and -b flags, lpsched will remember the directory-enabled print queues specified until it is restarted. Subsequent calls to lpstat -a and lpstat -p will report the status of all non-directory-enabled print queues as well as the directory-enabled print queues previously specified. Once lpsched has been restarted, the use of the all keyword with the lpstat command will once again only display non-directory-enabled print queues. The dslpsearch command should be used to search for defined directory-enabled print queues.

If you enter lpstat -?, the system displays the command usage message and returns 0.

Flags

-a [list]
Report whether print destinations are accepting requests. list is a list of intermixed printer names and class names.
-c [list]
Report names of all classes and their members. list is a list of class names.
-d
Report what the system default destination is (if any).
-f [list] [-l]
Verify that the forms in list are recognized by the LP print service. list is a list of forms; the default is all. The -l option will list the form parameters.
-o [list] [-l]
Report the status of print requests. list is a list of intermixed printer names, class names, and request-IDs. The keyletter -o may be omitted. The -l option lists for each request whether it is queued for, assigned to, or being printed on a local printer, the form required (if any), and the character set or print wheel required (if any). Note that required forms (if any) are not listed for remote printers.
-p [list] [-D] [-l]
If the -D flag is given, a brief description is printed for each printer in list. If the -l flag is given, a full description of each printer's configuration is given, including the form mounted, the acceptable content and printer types, a printer description, the interface used, and so on.

In order to maintain system security access information, the information needed to produce the printer status given by lpstat -p is available only if the LP scheduler is running.

-r
Report the status of the LP request scheduler (whether it is running).
-R
Report a number showing the rank order of jobs in the print queue for each printer.
-s [-l]
Display a status summary, including the status of the LP scheduler, the system default destination, a list of class names and their members, a list of printers and their associated devices, a list of the systems sharing print services, a list of all forms and their availability, and a list of all recognized character sets and print wheels. The -l flag displays all parameters for each form and the printer name where each character set or print wheel is available.
-S [list] [-l]
Verify that the character sets or the print wheels specified in list are recognized by the LP print service. Items in list can be character sets or print wheels; the default for list is all. If the -l flag is given, each line is appended by a list of printers that can handle the print wheel or character set. The list also shows whether the print wheel or character set is mounted or specifies the built-in character set into which it maps.
-t [-l]
Display all status information: all the information obtained with the -s flag, plus the acceptance and idle/busy status of all printers and status of all requests. The -l flag displays more detail as described for the -f, -o, -p, and -s flag.
-u [login-ID-list]
Display the status of output requests for users. The login-ID-list argument may include any or all of the following constructs:
login-ID
a user on the local system
system-name!login-ID
a user on system system-name
system-name!all
all users on system system-name
all!login-ID
a user on all systems
all
all users on the local system
all!all
all users on all systems
The default value of login-ID-list is all.
 

Security

Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in AIX Version 7.1 Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.