Cancel CUPS Print Jobs Safely with cancel
You will identify a CUPS job and cancel exactly that job, or deliberately cancel a set of jobs on a queue. Allow about ten minutes for a single cancellation. The commands here use the CUPS client installed on this machine, from cups-client version 2.4.7-1.2ubuntu7.14.
The route
Jump straight to the step you need, or tick off Done means at the end.
- 1. Confirm the client and inspect the queue
- 2. Cancel one known job
- 3. Cancel the current job on the default destination
- 4. Limit cancellation by destination or owner
- 5. Cancel all jobs only after a deliberate check
- 6. Choose connection and data-retention options carefully
- 7. Diagnose a failed cancellation
Cancellation changes the print queue. Read the target twice before pressing Enter, especially with -a. There is no general undo command for a job that has already been cancelled. The optional -x is more destructive because it also deletes the job's data files.
1. Confirm the client and inspect the queue
Start with read-only checks. You do not need elevated privileges to identify the client or ask CUPS for jobs:
$ command -v cancel
/usr/bin/cancel
$ dpkg-query -W -f='${Package} ${Version}\n' cups-client
cups-client 2.4.7-1.2ubuntu7.14
$ lpstat -o
printer-name-42 your-user 1024 Mon 22 Sep 2026 09:15:00 BST
The last command's output is host-specific. A job line normally includes a destination and an identifier such as printer-name-42. On a machine with no running scheduler, lpstat reports that the scheduler is not running instead of listing jobs. Fix the CUPS service or server connection before attempting cancellation; do not guess an identifier.
Checkpoint: write down the complete job ID you intend to cancel and, if relevant, its destination and owner.
2. Cancel one known job
Pass the complete job ID to cancel. This is the narrowest normal operation:
$ cancel printer-name-42
Do not treat a blank terminal as proof that the wrong job was selected. Check the queue again:
$ lpstat -o
# the cancelled job should no longer be listed
The exact confirmation and error text depend on the CUPS server and authentication policy. If the job is already printing, cancellation may stop it after the server accepts the request, while printer hardware can take a moment to react. Keep the job ID and any error message if you need to ask an administrator to investigate.
There is no local rollback for this command. If the document is still needed, submit it again through the original printing command after checking the destination and printer state.
3. Cancel the current job on the default destination
With no destination or ID, cancel targets the currently printing job on the default destination:
$ cancel
This default is easy to misread. It does not mean "cancel the last job I submitted" and it does not select every queue. Confirm which queue is the default with your normal CUPS configuration and inspect the current jobs before using the command. If you know the job ID, the explicit form from step 2 is safer.
4. Limit cancellation by destination or owner
Use a destination name when you need to cancel the current job associated with that destination:
$ cancel PRINTER_NAME
Printer and class names in CUPS are not case-sensitive, but they cannot contain spaces, tabs, a slash or a hash character. Use the name exactly as shown by your queue tools, and quote it if your shell command contains other values that may include special characters.
The -u option selects jobs owned by a username:
$ cancel -u YOUR_USERNAME
Check the server's authorisation policy before using this form. It requests cancellation of jobs for that owner; it is not a harmless filter. A server may require authentication or refuse jobs belonging to another user. The CUPS administrator controls whether unauthorised Cancel-Jobs operations are allowed, so do not work around a refusal with repeated guesses.
5. Cancel all jobs only after a deliberate check
-a cancels all jobs on the named destination, or all jobs on all destinations if no destination is supplied:
$ cancel -a PRINTER_NAME
That is a service-disrupting operation for everyone using the selected queue. Confirm the destination, owner impact and maintenance window first. To cancel every queued job known to the server, the command is:
$ cancel -a
Do not use this as a troubleshooting shortcut. Capture the queue listing before changing it if you may need to explain what was removed. There is no undo for the cancelled jobs; affected users must resubmit their documents.
6. Choose connection and data-retention options carefully
For a remote CUPS server, put -h first, as required by the installed manual page:
$ cancel -h print-server.example:631 printer-name-42
Replace the hostname and port with values from your environment. -E forces encryption for the connection, while -U YOUR_USERNAME supplies the username used for authentication:
$ cancel -h print-server.example:631 -E -U YOUR_USERNAME printer-name-42
Encryption protects the connection in transit, but it does not grant permission to cancel the job. Use the server's documented certificate and authentication setup. Do not place passwords in shell history or invent an option for supplying one on the command line.
Leave -x out unless you specifically need to purge the job data files:
$ cancel -x printer-name-42
Normal cancellation stops the job without requesting that extra deletion. With -x, recovery may be impossible if the document exists only in the spool. Preserve the original document and resubmit it rather than relying on spool data as a backup.
7. Diagnose a failed cancellation
First, run the read-only queue check again and compare the exact destination and job ID. A missing job may have completed, been cancelled by someone else, moved queues, or been submitted to a different CUPS server. If the scheduler is unavailable, verify the service and the remote host through your normal administration process.
If the server rejects the request, record the command without any password, the job ID, the server name and the error text. Ask the CUPS administrator about Cancel-Jobs authorisation in cupsd.conf. Do not add sudo automatically: CUPS permissions and authentication are server policy, and running the client as root does not repair a missing queue or an incorrect remote host.
Checkpoint: run lpstat -o once more. The intended job should be absent, or the server should give you a clear reason it remains.
Done means
- You confirmed the installed
cancelclient and CUPS version. - You identified the exact job, destination and owner before changing the queue.
- You used a job ID for a single cancellation where possible.
- You treated
-aas a queue-wide, service-disrupting action. - You left
-xout unless deleting spool data was an explicit requirement. - You checked the queue after the request and retained the original document if resubmission may be needed.