The lpq
command is used to display the status information about print jobs in the print queue. It is commonly used to check the status of print jobs, including the number of jobs in the queue, the status of each job, and the name of the user who submitted the job.
Overview
The lpq
command is used to display information about print jobs in the print queue. The syntax for the command is as follows:
lpq [options] [printer]
Where printer
is the name of the printer you want to check. If no printer is specified, the default printer is used.
The output of the lpq
command includes the following information:
- The job number
- The status of the job
- The name of the user who submitted the job
- The size of the job in bytes
- The time and date the job was submitted
Here is an example of how to use the lpq
command:
$ lpq
Printer: myprinter
Queue: 1 job on myprinter
Rank Owner Job File(s) Total Size
1st john 1234 myfile.txt 1024 bytes
In this example, the lpq
command displays the status of the print job with job number 1234
on the printer named myprinter
. The job was submitted by the user named john
, and the size of the job is 1024
bytes.
Options
The following table lists the available options for the lpq
command:
Option | Description |
---|---|
-P printer |
Specifies the name of the printer to check. |
-a |
Shows the status of all printers. |
-l |
Displays a more detailed output, including the time and date the job will be printed, the job priority, and the job size in pages. |
-H server |
Specifies the name of the print server to use. |
-U username |
Specifies the username to use when connecting to the print server. |
-h |
Displays a help message and exits. |
Troubleshooting tips
If the lpq
command does not display any output, there may be no print jobs in the queue. You can use the lp
command to submit a test print job and verify that the printer is working properly.
If the lpq
command displays an error message, make sure that the printer is properly configured and connected to the network. You may also need to check the printer’s log files for more information about the error.
Notes
- The
lpq
command is part of the Common Unix Printing System (CUPS) and is available on most Linux distributions. - The
lpq
command can be used in scripts to check the status of print jobs and take action based on the results. - The
lpq
command is a useful tool for system administrators who need to monitor the status of print jobs on multiple printers.