Check CUPS Queues Safely with the Deprecated lpc Command

Somebody says "the printer's broken", and lpc status gives you a read-only look at CUPS queues in seconds. This guide covers that query, then points you to the right tool when you need to administer a queue instead. Allow about ten minutes. The command is useful for a quick legacy check, but it is deliberately limited and deprecated.

1. Confirm the installed command

This guide uses the lpc supplied by Ubuntu's cups-bsd package. On the machine used for this guide, the package version is 2.4.7-1.2ubuntu7.14. Check your own package and executable before relying on exact behaviour:

$ dpkg-query -W -f='${Package} ${Version}\n' cups-bsd
cups-bsd 2.4.7-1.2ubuntu7.14
$ command -v lpc
/usr/sbin/lpc

Your version and path may differ. The local manual describes this program as a CUPS implementation of a small subset of the Berkeley lpc interface, not a general printer administration utility.

2. Query all visible queues

Run status without a queue name to ask for the state of one or more printer or class queues:

$ lpc status

On a host with no queues that CUPS exposes to this query, the command can produce no output and still return success. That is not evidence that a printer is ready. Capture the exit status separately when using the command in a script:

$ lpc status
$ printf 'exit=%s\n' "$?"
exit=0

With configured queues, the output is produced by the installed CUPS command and can vary with the queue names and state on that host. Do not write a script that assumes a particular human-readable line or column. If you need machine-friendly queue information, look at a current CUPS client such as lpstat instead of parsing lpc output.

Checkpoint: at this point you have performed a query only. lpc status does not enable, disable, accept, reject, cancel or reconfigure a queue. No elevated privileges are normally needed to ask for status. If a queue is missing, check the CUPS configuration and service using the tools appropriate to your distribution rather than guessing from an empty response.

3. Limit the query to one queue

Pass a queue name after status when you already know the printer or class name:

$ lpc status office_printer
$ printf 'exit=%s\n' "$?"
exit=0

Replace office_printer with the exact queue name configured on your CUPS server. The command accepts a printer or class queue, but the manual does not promise a useful diagnostic for every unknown name, so an empty response or successful exit needs another check before you report the queue as healthy.

Keep the query separate from any command that changes a queue. A status check is safe to repeat, which makes it suitable for a troubleshooting note or a first pass during an incident. It does not prove that jobs can print, that a device is powered on, or that a remote server is reachable.

4. Use the interactive prompt only for help

With no command-line argument, lpc starts an interactive command interpreter. Ask it for its short command list, then leave it explicitly:

$ lpc
lpc> help
Commands may be abbreviated.  Commands are:

exit    help    quit    status  ?
lpc> exit

The prompt accepts help or ?, optionally followed by a command, and exit or quit to leave. For a repeatable shell command, prefer lpc status: an interactive session is easy to leave running in a terminal or automation job. If you use it in a script, provide input deliberately and include an explicit exit command.

5. Do not use lpc to configure CUPS

This is the boundary that causes most mistakes. The installed manual says that lpc cannot configure CUPS printer or class queues. It has no documented commands for adding a printer, changing a device URI, setting a shared queue, accepting jobs or enabling a destination.

For configuration, use lpadmin or another CUPS-compatible client, and check that tool's documentation before changing a live queue: those operations can affect other users and may require elevated privileges. Do not improvise an lpc subcommand based on another operating system's Berkeley printing tools. This CUPS version accepts only exit, help, quit and status.

Warning: do not run a configuration command as root merely because lpc status showed nothing. First identify the intended CUPS server and queue, then make one documented change at a time. To undo a configuration change, use the corresponding documented CUPS command or restore the backed-up configuration through your normal administration process. There is no general lpc undo command.

6. Handle the deprecation

The CUPS manual marks lpc as deprecated and says it will be removed in a future feature release. Keep it for compatibility checks or a small legacy diagnostic, but avoid making new tooling depend on it.

Do not remove cups-bsd from a production machine as part of this guide: other legacy commands in that package may still be in use.

Common traps

Done means