Bootstrap FreeKB - Linux Commands - lpq (print queue)
Linux Commands - lpq (print queue)

Updated:   |  Linux Commands articles

Before printing, you may want to use the lpstat or lpc commands to list the available printers. You may want to also use the pr command to format a file for printing.

There are a few different commands that can be used to sent print jobs to the printer.

  • lp (Line print)
  • lpr (Line print request)
  • lpd (Line print daemon)

After sending the print job to the printer, the lpq command can be used to view the print job in the queue. The lpq command without any options shows every print queue.

lpq
. . .
HP-Photosmart-C6200-seriesCMD:PCL is ready
Rank     Owner  Job  File(s)          Total Size
active   root    1   formatted-file   1024 bytes
active   root    3   Example Job Name 1024 bytes

HP-Lasterjet-4000 is ready
Rank     Owner  Job  File(s)          Total Size
active   root    2   formatted-file   1024 bytes

 

The -P option can be used to specify a certain printer or queue.

lpq -P HP-Lasterjet-4000
. . .
HP-Lasterjet-4000 is ready
Rank     Owner  Job  File(s)          Total Size
active   root    2   formated-file    1024 bytes

 

Cancelling a print job

If some problem occurs, and the print job doesn't print, we can cancel the print jobs in the queue. The lpq cancel command with no options cancels the current print job on the default printer. 

lpq cancel

 

The lpq cancel -a command without any additional options cancels every print job on every printer being managed by CUPS in the network.

lpq cancel -a

 

The lpq cancel -a command followed by the printer name will cancel every print job on a certain printer.

lpq cancel -a printer_name

 

The lprm command can be used to remove print jobs.

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 3ab955 in the box below so that we can be sure you are a human.