lprm – Delete Print Jobs in the Print Queue

The lprm command is used to delete print jobs in the print queue. It is a command-line utility that enables the user to remove print jobs from the queue that are no longer needed or have been printed already.

Overview

The syntax for the lprm command is as follows:

lprm [options] [job ID(s)]

The options argument is optional and can be used to modify the behavior of the lprm command. The job ID(s) argument is also optional and can be used to specify the ID of the job that needs to be deleted. If no job ID is specified, the command will delete the first job in the queue.

To delete a print job, the user needs to know the ID of the job that needs to be deleted. The job ID can be obtained by running the lpq command, which displays the print queue and the job IDs associated with each print job. Once the job ID is known, the user can run the lprm command with the appropriate options and job ID to delete the print job.

Examples

To delete the first job in the print queue, run the following command:

lprm

To delete a specific job with ID 123, run the following command:

lprm 123

To delete all jobs in the queue, run the following command:

lprm -

Options

The lprm command supports the following options:

Option Description
-P destination Specifies the printer destination to use.
Deletes all jobs in the queue.
-U username Specifies the username to use when deleting jobs.
-i Prompts the user for confirmation before deleting each job.
-r Deletes all jobs owned by the current user.
-s Displays a summary of the jobs that have been deleted.
-V Displays the version of the lprm command.

Troubleshooting Tips

If the lprm command fails to delete a print job, try the following troubleshooting tips:

  • Ensure that the correct job ID has been specified.
  • Check that the printer is online and available.
  • Verify that the user has the necessary permissions to delete print jobs.
  • Restart the print system using the systemctl restart cups command.

Notes

  • The lprm command is part of the Common Unix Printing System (CUPS) and is available on most Linux distributions.
  • The lprm command can only delete print jobs that have not yet been printed. Once a print job has been printed, it is no longer in the queue and cannot be deleted using the lprm command.