Clear A Print Queue Spooler In Linux

How to clear print queue in Linux?

This often occur when you may accidentally 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 mylinuxlogin 248 (stdin) 0 bytes
2nd mylinuxlogin 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

---

lpq Command

lpq - show printer queue status 

Synopsis

lpq [ -E ] [ -P dest ] [ -a ] [ -l ] [ +interval ] 

Description

lpq shows the current print queue status on the named printer. Jobs queued on the default destination will be shown if no printer or class is specified on the command-line.

The interval option allows you to continuously report the jobs in the queue until the queue is empty; the list of jobs is show one every interval seconds.

The -E option forces encryption when connecting to the server. 

The -a option reports jobs on all printers. 

The -l option requests a more verbose (long) reporting format. 

Linux Tips

See Also

Have a Linux Problem
Linux Forum - Do you have a Linux Question?

Linux Books
Linux Certification, System Administration, Programming, Networking Books

Linux Home: Linux System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.