If you change your mind about printing a job, you can remove the job from the queue with the lprm command. Often, you can even use lprm to remove an active job, but some or all of the job might still get printed.
To remove a job from the default printer, first use lpq to find the job number. Then type
lprm job-number
To remove the job from a specific printer, add the -P
option. The following command removes job number 10 from
the queue for the printer bamboo
:
lprm -P bamboo 10
The
lprm command has a few shortcuts:
Removes all jobs (for the default printer) belonging to you.
Removes all jobs (for the default printer) belonging to user. The superuser can remove other users' jobs; you can remove only your own jobs.
With no job number, user name, or ``-
'' appearing
on the command line,
lprm removes the currently
active job on the default printer, if it belongs to
you. The superuser can remove any active job.
Just use the -P
option with the above shortcuts to
operate on a specific printer instead of the default. For
example, the following command removes all jobs for the
current user in the queue for the printer named rattan
:
lprm -P rattan -
Note: If you are working in a networked environment,
lprm will let you remove jobs only from the host from which the jobs were submitted, even if the same printer is available from other hosts. The following command sequence demonstrates this:
rose% lpr -P rattan myfile rose% rlogin orchid orchid% lpq -P rattan Rank Owner Job Files Total Size active seeyan 12 ... 49123 bytes 2nd kelly 13 myfile 12 bytes orchid% lprm -P rattan 13 rose: Permission denied orchid% logout rose% lprm -P rattan 13 dfA013rose dequeued cfA013rose dequeued rose%