Previous Table of Contents Next

Module 12
cancel (SV)


The external cancel command removes or cancels print requests made with the lp command. The cancel command allows you to:

*  Remove requests from a printer request queue.
*  Stop a request currently printing on a printer.

The cancel command is used in conjunction with the lp and lpstat command. You may need to use the lpstat command to decide which request you want to cancel. When you cancel a request that is printing, the printer is signaled to stop printing. The request is removed and the next request is sent to the printer.


Following is the general format of the cancel command.

     cancel [ request-ID ] [ printer ]
     cancel [ -u login-ID ] [ printer ]


The following option may be used to control how cancel functions.

-u login-ID Cancel all requests for the specified user. Where login-ID can be the username or login-ID.


The following list describes the arguments that may be passed to the cancel command.

request-ID The request is removed from the request queue or stopped if currently printing.
printer Stops the current request printing on the specified printer. The request must belong to you.


Refer to the lp and lpstat commands described in modules 79 and 83.


The requests that cancel removes are actually files stored in the /usr/spool/lp/request directory.


You can use the cancel command to stop the printing of a request or remove the request from the print queue. It is useful when you have sent a print request to the wrong printer or a printer which is no longer in service.


In this activity you use the cancel command to remove a request submitted by the lp command. Begin at the shell prompt.

1.  Type ls -x /bin | lp and press Return. Notice the request ID that lp returns to your screen.
     cj> ls -x /bin | lp
     request id is dp-1492 (1 file)
2.  Now type cancel dp-1492 to cancel the request. Replace the dp-1492 with your request ID.
3.  Turn to Module 83 to continue the learning sequence.

Previous Table of Contents Next