The lpq command, meaning list print queue, is a command-line utility in the Linux system to display the status of the print queue for a specified printer or class1. The lpq command can take various options and arguments to filter and format the output. By default, the lpq command shows the print queue for the default printer or class, which is determined by the PRINTER or LPDEST environment variables, or the /etc/printcap file. For example, to display the print queue for the default printer, one can run:
lpq
The output shows the printer name, status, rank, owner, job number, file size, and file name for each print job. For example, the output may look like:
Printer: lp@localhost ‘HP LaserJet 1020’ Queue: no printable jobs in queue Server: no server active Status: printer idle. enabled since Tue 09 Nov 2021 10:00:00 AM EST Rank Owner Job File(s) Total Size 1st alice 123 report.pdf 1024 bytes 2nd bob 124 memo.docx 2048 bytes 3rd charlie 125 presentation.pptx 4096 bytes
This shows that there are three print jobs in the queue for the printer lp@localhost, which is an HP LaserJet 1020. The first job belongs to alice, the second to bob, and the third to charlie. The lpq command can also display the print queue for a specific printer or class by using the -P option, followed by the printer or class name. For example, to display the print queue for the printer lp1, one can run:
lpq -P lp1
The output shows the print queue for the printer lp1, which may be different from the default printer. The lpq command can also display the print queue for all printers or classes by using the -a option. For example, to display the print queue for all printers or classes, one can run:
lpq -a
The output shows the print queue for each printer or class, separated by a blank line. The lpq command is different from the following commands:
lpd: This is not a command, but a daemon that provides print spooling and network printing services for the Linux system2. The lpd daemon is started by the system initialization scripts and runs in the background. It does not display the print queue for any printer or class.
lpr: This is a command that submits print jobs to the print queue for a specified printer or class3. The lpr command can take various options and arguments to specify the print options and the files to be printed. For example, to print the file report.pdf to the default printer, one can run:
lpr report.pdf
The lpr command does not display the print queue for any printer or class.
lp: This is a command that submits print jobs to the print queue for a specified printer or class, similar to the lpr command4. The lp command can take various options and arguments to specify the print options and the files to be printed. For example, to print the file report.pdf to the printer lp1, one can run:
lp -d lp1 report.pdf
The lp command does not display the print queue for any printer or class.
lsq: This is not a valid command in the Linux system. It may be a typo or a misspelling of the lpq command. It does not display the print queue for any printer or class. References:
1