lprm is a useful tool for removal of active or queued print jobs. Lets start by having a look at line printer queue status using lpq utility. Simply type lpq at the shell to produce a list of active and queued jobs for your default printer.
printer is ready and printing Rank Owner Job File(s) Total Size 1st kamil 835 whereis.com - Print Map 3708928 bytes active kamil 1017 Acro000FQWgE9 10109952 bytes 2nd kamil 1018 Acro000MfwkZm 10376192 bytes 3rd kamil 1019 Acro0003dbDUJ 10376192 bytes 4th kamil 1022 IEEE Signal Processing Letters 62464 bytes
The above output shows that there are number of print jobs in the print queue. Unfortunately, the first job, whereis.com - Print Map, failed to print and it has been sitting there for a while. Meanwhile, another print job, this time a pdf acrobat document, Acro000FQWgE9, is marked as active but has failed to print and is preventing the subsequent jobs from printing. OK, to fix the problem, lets remove all the stale jobs using lprm with their job identifiers as follows.
lprm 835 1017
To verify that lprm worked we again use the lpq command.
lpq
As shown below jobs 835 and 1017 disappeared from the line printer queue.
printer is ready and printing Rank Owner Job File(s) Total Size active kamil 1018 Acro000MfwkZm 10376192 bytes 1st kamil 1019 Acro0003dbDUJ 10376192 bytes 2nd kamil 1022 IEEE Signal Processing Letters 62464 bytes
Immediately following this, our hp2420dn printer started working again. The remaining jobs were printed leaving the queue with no entries as shown below.
printer is ready no entries