lpc - Linux


Overview

lpc stands for Line Printer Control program. It is used to control printer spools and interact with line printer spooling systems. The command is typically used to manage printer queues, enabling the user to start or stop the scheduler, disable or enable printers, and display the status of printers. It is most effective in environments where batch printing is frequent or in networked settings where multiple printers are managed.

Syntax

The basic syntax for using the lpc command is:

lpc [options] command [printer-name]
  • options: These modify how the lpc behaves.
  • command: Specifies the action to be performed, such as status or topq.
  • printer-name: Optional, specifies the target printer. If omitted, commands apply to all printers.

Options/Flags

There are a few options available with lpc, primarily for debugging:

  • -d: Provides more detailed debug output.
  • -? or --help: Display a help message and exit.
  • --version: Output version information and exit.

Commands can vary depending on your system but typically include:

  • status: Displays the status of specified printers.
  • stop: Stops the specified printer.
  • start: Starts the specified printer.
  • disable: Disables printing on a printer.
  • enable: Enables printing on a printer.

Examples

  1. Check the status of all printers:
    lpc status
    
  2. Disable printing on a printer named officejet:
    lpc disable officejet
    
  3. Start the printer scheduler (often cupsd or similar):
    lpc start
    

Common Issues

  • Permissions: Users might encounter permission errors if they do not have the required rights to manage printers. Ensure the user has adequate permissions or use sudo if necessary.
  • Printer not found: If you specify a printer that does not exist or is not recognized, ensure the printer name is correct and that it is properly configured on the system.

Integration

The lpc command can be used in scripts to automate printing management tasks. For example, to stop all printers before performing system maintenance:

for printer in $(lpc status | awk '/printer/ {print $2}')
do
    lpc stop $printer
done

You can integrate lpc with cron jobs to schedule enable/disable operations during off-hours.

  • lpq: Displays the status of a print queue.
  • lpr: Used to submit jobs to the printer.
  • lpstat: Provides more detailed status of CUPS printers and their jobs.
  • cupsenable and cupsdisable: Equivalent to enable and disable for CUPS-managed printers.

For more detailed documentation and newer features, refer to the specific lpc man page on your system (man lpc) or visit the official CUPS documentation when using CUPS-related features.