lpc Command in Linux



The lpc command in Linux stands for the Line Printer Control program. It provides limited control over printer and class queues provided by the Common UNIX Printing System (CUPS). It can also be used to query the state of print queues. If no command is specified on the command line, lpc displays a prompt and accepts commands from the standard input.

The lpc command is a legacy tool used to control line printers on Unix-like systems, including Linux. While it was once widely used, its relevance has diminished with the advent of more modern printing systems like CUPS.

Table of Contents

Here is a comprehensive guide to the options available with the lpc command −

Understanding lpc Command

The lpc command is a powerful tool for managing and controlling line printers in Linux systems. It provides a range of functionalities to interact with the printer queue, allowing you to check the status of print jobs, cancel print jobs, and more.

While lpc is still available on many Linux systems, it's generally recommended to use CUPS for most printing tasks. However, if you're working with a legacy system or a specific printing setup that relies on lpc, you may find it useful for basic printer control.

How to Use lpc Command in Linux?

The lpc command in Linux provides control over line printer operations. It allows you to manage print queues, start or stop printers, and check the status of print jobs. While lpc remains a functional tool, its limited capabilities and the increasing popularity of CUPS have made it less relevant in modern Linux environments. For most users, CUPS is the preferred choice for managing printing tasks.

Basic Usage

Without any arguments, lpc enters interactive mode, prompting you for commands.

lpc [command [parameter]]

lpc Commands Options

  • status [queue] − Displays the status of one or more printer or class queues. If no queue is specified, it shows the status of all queues.
  • help [command] − Displays a short help message. If a specific command is provided, it shows help for that command.
  • exit − Exits the command interpreter.
  • quit − Another way to exit the command interpreter.

Examples of lpc Command in Linux

Displays the status of all printers

Displays the status of all printers or a specific printer via lpc status [printer] −

lpc status lp1
lpc Command in Linux1

Starts a specified printer

Starts a specified printer via lpc start printer command −

lpc start lp1
lpc Command in Linux2

Stops a specified printer

Stops a specified printer via the lpc stop printer command −

lpc stop lp1
lpc Command in Linux3

Enables job submission

Enables job submission to a specified printer via the lpc accept printer command −

lpc accept lp1
lpc Command in Linux4

Disables job submission

Disables job submission to a specified printer via the lpc reject printer command −

lpc reject lp1
lpc Command in Linux5

Enables job processing

Enables job processing and printing for a specified printer via the lpc enable printer command −

lpc enable lp1
lpc Command in Linux6

Disables job processing

Disables job processing and printing for a specified printer. It usage is lpc disable printer −

lpc disable lp1
lpc Command in Linux7

Clears the print queue

Clears the print queue for a specified printer via lpc clear printer command −

lpc clear lp1
lpc Command in Linux8

Moves a job to a different position in the print queue

Usage: lpc move job_number new_position printer. (Moves job number 3 to the first position in the lp1 queue)

lpc move 3 1 lp1
lpc Command in Linux9

Cancels a specific job or all jobs in a print queue

Usage: lpc abort job_number printer or lpc abort all printer. (Cancels job number 2 in the lp1 queue)

lpc abort 2 lp1
lpc Command in Linux10

Interactive Mode

When you run lpc without any arguments, it enters interactive mode. You can then enter commands directly at the lpc> prompt. For example −

lpc> status
lpc> clear lp1
lpc> exit

Note − The specific printers available and their names may vary depending on your system's configuration. You can use the lpq command to list available printers and their status.

To check the status of all printer queues −

lpc status

To cancel all print jobs belonging to the user "john" −

lpc cancel john

To move print job number 10 to the front of the queue −

lpc move 10 1

The lpc command in Linux is used to control line printers and manage printer and class queues provided by the Common UNIX Printing System (CUPS). Here are the options and commands you can use with lpc

Displays the status of one or more printers or class queues

If no queue is specified, it shows the status of all queues.

lpc status
lpc status printer_name

Displays a short help message

If a specific command is provided, it shows help for that command.

lpc help
lpc help status
lpc Command in Linux11

Exits the command interpreter

Exits the command interpreter

lpc exit
lpc Command in Linux12

Another way to exit the command interpreter

lpc quit
lpc Command in Linux13

Additional Notes − By mastering the lpc command, you can efficiently manage your printing tasks and troubleshoot any issues that may arise.

By effectively using the lpc command, you can efficiently manage your print jobs and troubleshoot any issues that may arise with your printer system.

Check the Status of a Specific Printer − Replace printer_name with the name of the printer you want to check. This command shows the status of the specified printer queue.

lpc status printer_name

Get Help for a Specific Command − This command provides help information for the status command.

lpc help status
lpc Command in Linux14

Limitations − Since lpc is geared towards the Berkeley printing system, it is impossible to use lpc to configure printer or class queues provided by CUPS. To configure the printer or class queues, you must use the lpadmin command or another CUPS-compatible client that has that functionality.

Conclusion

The specific commands and options available may vary depending on the printing system being used. The lpc command is often used in conjunction with other printing tools like lp, lpr, and lpq. For more advanced usage and detailed information, consult the lpc man page.

The lpc command is geared towards the Berkeley printing system, so it cannot be used to configure printer or class queues provided by CUPS. For configuration, you must use the lpadmin command or another CUPS-compatible client.

Advertisements