Removing Jobs from the Queue with the lprm CommandThe lprm command can be used to remove print jobs that are currently in the queue and sometimes to remove print jobs that are currently printing. If lprm is run without any command-line arguments, it will remove whatever job is currently printing on the default printer if that job belongs to the user running lprm. If the currently running job does not belong to the user running lprm, the command will have no effect. If the root user runs lprm with no options, the command will remove the currently printing job from the default printer, no matter who the job belongs to. Running lprm with a job number as an argument will remove the job with that ID number from the queue of the default printer, assuming that you own the job and that you are not the root user. Normal users can only remove jobs that belong to them. The root user can remove any job. Use lpq (as described in the previous section) to determine a job's ID, which you can then feed to lprm. Here is an example: # lprm 5 dfA001simba.example.com dequeued cfA001simba.example.com dequeued This command "dequeues" (removes from the queue) two files associated with job ID 5: the spooled copy of the file (beginning with dfA001), and a control file. When both these files have been deleted, the print job stops, and any data not yet spooled to the printer is discarded. Note The system may take some time to respond when you run lprm (up to several seconds). It may seem that lprm has hung. Don't worry; it hasn't. Wait a few seconds, and you should get your prompt back. If you try to delete a job that does not belong to you, and you are not the root user, lprm will respond with the message Permission denied. The lprm command has a few options to modify the default behavior. These are listed in Table 17.5.
Caution Removing a job that is currently printing will not cause the printer to stop immediately. Depending on the amount of RAM installed in your printer, there could be up to several pages of data already in the printer's buffer. This means that some of the document could be printed anyway (or if the document is small enough, almost the entire document could be printed), even if it has been removed from the queue. Note Print jobs can be removed only from the system they were sent from, even if the printer is available to more than one computer on the network. |