lpc

system administrationLinux/Unix
The lpc command is one of the most frequently used commands in Linux/Unix-like operating systems. lpc Line printer control program

Quick Reference

Command Name:

lpc

Category:

system administration

Platform:

Linux/Unix

Basic Usage:

lpc [options] [arguments]

Common Use Cases

    Syntax

    lpc [command [argument ...]]

    Options

    Command Description
    abort {all | printer} Terminate an active spooling daemon on the local host
    clean {all | printer} Remove all jobs from the specified printer queue
    disable {all | printer} Turn the specified printer queue off
    down {all | printer} message Disable printing and spooling with a message
    enable {all | printer} Enable printing on the specified printer
    exit Exit from lpc
    help [command] Display help information
    quit Exit from lpc
    restart {all | printer} Restart printer daemon(s)
    start {all | printer} Enable printing and start the spooling daemon
    status {all | printer} Display the status of daemons and queues
    stop {all | printer} Stop the spooling daemon after current job completes
    topq printer [jobnum...] Move the specified jobs to the top of the printer queue
    up {all | printer} Enable printing and spooling

    Examples

    How to Use These Examples

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

    # Basic Examples Basic
    lpc status
    Display the status of all printers.
    lpc status lp
    Display the status of the printer named "lp".
    # Advanced Examples Advanced
    lpc up lp Enable printing and spooling for the printer "lp". lpc down lp "Printer maintenance" Disable printing and spooling for printer "lp" with a message. lpc enable lp Enable printing on printer "lp" (spooling remains enabled). lpc disable lp Disable printing on printer "lp" (spooling remains enabled). lpc restart lp Restart printer "lp", which clears the current state. lpc abort lp Terminate active printing on printer "lp". lpc clean lp Remove all print jobs from printer "lp". lpc topq lp 123 456 Move print jobs 123 and 456 to the top of the queue for printer "lp".

    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 'lpc' (Line Printer Control) command is a system administration utility for controlling line printers and their associated spooling queues. It provides a comprehensive set of functions for managing printer operations in Unix and Linux systems, particularly those using the Berkeley printing system (LPD - Line Printer Daemon). Key features of the lpc command: 1. Printer Status Monitoring: lpc allows administrators to check the current status of printers and their queues, showing information about active jobs, queue length, and printer state. 2. Printer Control: Administrators can enable or disable printing and spooling operations, which is useful for maintenance or managing printer availability. 3. Queue Management: The command provides functionality for manipulating print job queues, including moving jobs to the top of the queue or removing all jobs. 4. Daemon Control: lpc can start, stop, or restart printer daemons, which is essential for applying configuration changes or recovering from errors. 5. Multiple Printer Support: The utility can manage individual printers or all printers on the system simultaneously using the 'all' parameter. 6. Interactive Mode: When run without arguments, lpc enters an interactive mode where multiple commands can be issued without restarting the program. 7. Status Messages: Administrators can provide informative messages when disabling printers, which are displayed to users who attempt to use the printer. Historically, lpc was a central tool in the Berkeley printing system, but its relevance has diminished with the adoption of newer printing systems like CUPS (Common Unix Printing System) in modern Linux distributions. However, many distributions still include lpc for backward compatibility or for systems that continue to use LPD. In CUPS-based systems, lpc may be implemented as a compatibility layer that translates commands to their CUPS equivalents, though with potentially limited functionality compared to native CUPS administration tools like 'cupsenable', 'cupsdisable', and the web-based CUPS administration interface. Administrators working in environments with multiple printing systems should be aware of which printing system is in use and choose the appropriate management tools accordingly.

    Related Commands

    These commands are frequently used alongside lpc 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 lpc command works in different scenarios.

    $ lpc
    View All Commands