Linux, How to clear a printer queue

Written by
Date: 2010-02-02 10:36:30 00:00


How to clear a print queue (spooler) in Linux

It may happen that you have send a real big job to the printer, and then you realize that, you forgot to change the paper size from A4 to letter, or any other scenario where you may need to change something in a document already sent to the printer queue, so now you need to cancel it. So first lets see the spooler (Printer queue)

lpq

This will list all your jobs sent to the printer.

BJC-250 is ready
Rank    Owner   Job     File(s)                         Total Size
1st     ggarron 248     (stdin)                         0 bytes
2nd     ggarron 249     (stdin)                         0 bytes

Now if you want to stop jobs, you can use the cancel command.

You can cancel only jobs owned by you, or by an specified user (provided that you have the rights to do it).

cancel -u user

This will cancel all jobs belonging to a certain user, but, if you want to cancel all jobs, no matter who owns them use this command.

cancel -a

Of course you have to have the right to do so, and even then, first ask before doing it.