cancel
Cancel print jobs
TLDR
Cancel the current job of the default printer (set with lpoptions -d {{printer}})
Cancel the jobs of the default printer owned by a specific [u]ser
Cancel the current job of a specific printer
Cancel a specific job from a specific printer
Cancel [a]ll jobs of all printers
Cancel [a]ll jobs of a specific printer
Cancel the current job of a specific server and then delete ([x]) job data files
SYNOPSIS
cancel [ -E ] [ -U username ] [ -a ] [ -e ] [ -h hostname[:port] ] [ -u username ] [ id ] [ destination ] [ destination-id ]
PARAMETERS
-E
Forces encryption when connecting to the server.
-U username
Specifies the username to use when connecting to the server. This is useful for authentication if the CUPS server requires it.
-a
Cancels all jobs on the specified destination, or all jobs on the default destination if no destination is specified.
-e
Cancels all jobs on the default destination for all users. This typically requires administrative privileges (e.g., root).
-h hostname[:port]
Connects to the specified CUPS server instead of the default local server. The port can be optionally specified.
-u username
Cancels jobs owned by the specified user. This also typically requires administrative privileges if the user is not the invoking user.
id
The numeric ID of the print job to cancel. This ID is typically obtained using `lpq` or `lpstat`.
destination
The name of the printer or class where the job is spooled. When used with `id`, it cancels the specific job on that destination.
destination-id
A combination of the destination name and job ID (e.g., printername-123). This is a common and explicit way to specify a job.
DESCRIPTION
`cancel` is a command-line utility used to remove print jobs from the CUPS (Common Unix Printing System) spooler. It allows users to terminate jobs that are pending, currently printing, or held, preventing them from being processed further by the printer. Users can specify which job to cancel using its unique job ID, the printer destination name, or a combination of both. When invoked without arguments, it attempts to cancel the current job on the default printer. To cancel jobs submitted by other users, administrative privileges (e.g., root or a member of the lpadmin group) are often required. This command is an essential tool for managing print queues, resolving printing issues, and maintaining efficient printer operation within a networked or local printing environment managed by CUPS.
CAVEATS
Permissions are crucial: A regular user can only cancel their own jobs. To cancel jobs belonging to other users or all jobs, administrative privileges (e.g., root, or being in the lpadmin group) are generally required.
Job IDs are temporary: Once a job is processed or cancelled, its ID may be reused or become invalid.
Network connectivity: When connecting to a remote CUPS server using -h, network issues can prevent the command from functioning correctly.
<B>JOB IDENTIFICATION</B>
Jobs can be identified by their numeric job ID (e.g., `123`), by the printer destination name (e.g., `laserjet`), or by a combination of both (e.g., laserjet-123). When no arguments are provided, `cancel` attempts to cancel the currently active job for the user on the default printer. Using `lpstat -o` or `lpq` is recommended to get accurate job IDs before attempting to cancel.
<B>DEFAULT BEHAVIOR</B>
If no arguments are provided, `cancel` attempts to cancel the "current" job on the default printer. The definition of "current" can sometimes be ambiguous, referring to the last job submitted or the one currently being processed. For reliable operation, it's generally safer to specify a job ID or destination explicitly, especially in environments with multiple active jobs.
HISTORY
The `cancel` command is an integral part of the CUPS (Common Unix Printing System) package, which was originally developed by Easy Software Products and later acquired by Apple Inc. It provides a standardized and robust printing solution for Unix-like operating systems. `cancel` superseded older, less consistent job cancellation utilities found in traditional BSD or System V printing systems, providing a unified approach under CUPS. Its evolution has been tied directly to the development and widespread adoption of CUPS as the de facto standard for printing on Linux and macOS, ensuring consistent print job management.