Cups Printer Management from Command Line

Refer: https://www-uxsup.csx.cam.ac.uk/pub/doc/suse/suse9.1/adminguide9.1/ch05s07.html

Sample Commands

Help

lpstat --help

General Status

lpstat -t

List of Printers

lstat -v

5.7.3.Using Command-Line Tools for CUPS Troubleshooting

Print jobs will be kept in the printer queue if you shut down the system while a job is being processed. This means a broken print job will still be there even after rebooting and you need to remove it from the queue manually with the commands mentioned above.

Other problems occur if there is some fault in the physical data link between the computer and the printer. The printer may then be unable to make sense of the data it receives and start spitting out lots of pages with garbage on them.

To make sure the printer stops working, first remove all paper from it (in the case of inkjet printers) or open the paper trays (laser printers).

At this point, the print job will often still be in the queue, because jobs are only removed from the queue when all data has been sent to the device. Check which queue is currently printing by entering

lpstat -o

Then remove the problematic print job wit

cancel queuename-jobnumber

Some data might still find their way to the printer in spite of the job having been deleted. To stop this, enter the command fuser -k /dev/lp0 (for a printer at the parallel port) or fuser -k /dev/usb/lp0 (for a USB printer). This kills any processes still using the printer device.

Do a complete reset of the printer by disconnecting it from power for some time. Then put in the paper and switch the printer back on.