lprm

system administrationLinux/Unix
The lprm command is one of the most frequently used commands in Linux/Unix-like operating systems. lprm Remove jobs from the print queue

Quick Reference

Command Name:

lprm

Category:

system administration

Platform:

Linux/Unix

Basic Usage:

lprm [options] [arguments]

Common Use Cases

    Syntax

    lprm [options] [job_id...]

    Options

    Option Description
    - Remove all jobs owned by the current user
    -P printer Specify the printer queue
    -h server Specify the print server
    -U username Specify the user (requires appropriate permissions)
    -V Display the CUPS version number
    -E Force encryption when connecting to the server

    Examples

    How to Use These Examples

    The examples below show common ways to use the lprm command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.

    # Basic Examples Basic
    lprm 123
    Remove print job with ID 123 from the default printer queue.
    lprm -P laser 123
    Remove print job 123 from the queue for the printer named "laser".
    # Advanced Examples Advanced
    lprm - Remove all print jobs owned by the current user. lprm -P laser - Remove all of the current user's print jobs from the printer named "laser". lprm -U admin 123 Remove job 123 as the user "admin" (requires appropriate permissions). lpq # Identify jobs in the queue Rank Owner Job File(s) Total Size active user 123 document.txt 1024 bytes 1st user 124 report.pdf 2048 bytes lprm 123 124 # Remove multiple print jobs by ID

    Try It Yourself

    Practice makes perfect! The best way to learn is by trying these examples on your own system with real files.

    Understanding Syntax

    Pay attention to the syntax coloring: commands, options, and file paths are highlighted differently.

    Notes

    The 'lprm' (line printer remove) command is a standard Unix/Linux utility for removing print jobs from a printer's queue. It's an essential tool for print queue management, allowing users to cancel unwanted print jobs before they're printed. Key features of the lprm command: 1. Job Cancellation: The primary function of lprm is to allow users to remove their own print jobs from the queue when they no longer want them printed. 2. Selective Removal: Users can specify which jobs to remove by job ID, allowing for precise control over the print queue. 3. Bulk Cancellation: Using the '-' parameter, users can remove all of their jobs at once, which is useful when clearing multiple unwanted print jobs. 4. Printer Selection: In multi-printer environments, the -P option allows users to target a specific printer's queue. 5. Administrative Control: System administrators can remove any job from the queue, implementing proper access control for queue management. 6. Integration with Print Systems: lprm works with both traditional BSD printing systems and modern CUPS (Common Unix Printing System), though the specific behavior may vary slightly between implementations. Common use cases for lprm include: - Cancelling a print job sent in error - Removing jobs when the printer is malfunctioning - Clearing personal jobs from the queue to allow other users' jobs to print - Administrative management of print queues The lprm command is typically used in conjunction with lpq (to view the print queue) and lpr (to submit print jobs). Together, these commands form the core user interface for the Berkeley printing system. In CUPS-based systems, lprm is maintained for compatibility, but its functionality is also available through the 'cancel' command, which offers similar capabilities with some CUPS-specific extensions. It's important to note that users can typically only remove their own print jobs, while the superuser (root) or printer administrators can remove any job from the queue. This security model ensures that users have control over their own print jobs while preventing them from interfering with others' jobs.

    Related Commands

    These commands are frequently used alongside lprm or serve similar purposes:

    Use Cases

    Learn By Doing

    The best way to learn Linux commands is by practicing. Try out these examples in your terminal to build muscle memory and understand how the lprm command works in different scenarios.

    $ lprm
    View All Commands