Jump to Navigation

280 - CUPS Cancel Print Jobs

If you are using CUPS, sometimes you want to cancel some print queues. So "lprm" is a useful command for that.

lprm will remove a job, or jobs, from a printer’s spool queue. Since the spooling directory is protected from users, using lprm is normally the only method by
which a user may remove a job. The owner of a job is determined by the user’s login name and host name on the machine where the lpr(1) command was invoked.

 lprm [-Pprinter] [-] [job # ...] [user ...]

Options and arguments :

Specify the queue associated with a specific printer (otherwise the default printer is used).

If a single ‘-’ is given, lprm will remove all jobs which a user owns. If the super-user employs this flag, the spool queue will be emptied entirely.
user’ Causes lprm to attempt to remove any jobs queued belonging to that user (or users). This form of invoking lprm is useful only to the super-user.

# lpq -a

Rank    Owner   Job     File(s)  Total Size
1st  root    199794  PRINT001 2048 bytes

# lprm 199794


# lprm -

A user may dequeue an individual job by specifying its job number. This number may be obtained from the lpq(1) program, e.g.

** You got the following error :

lprm: The printer-uri attribute is required!

You should command as the following.

# cancel -a

 cancel cancels existing print jobs. The -a option will remove all  jobs from the specified destination.


Shell Script:

Main menu 2

Story | by Dr. Radut