lpstat
Show printer status information
TLDR
List printers present on the machine and whether they are enabled for printing
Show the default printer
Display all available status information
List print jobs queued by a specific user
SYNOPSIS
lpstat [ -E ] [ -H ] [ -U username ] [ -l ] [ -v ] [ -a [destination(s)] ] [ -c [class(s)] ] [ -d ] [ -p [destination(s)] ] [ -o [destination(s)] ] [ -r ] [ -s ] [ -t ] [ -u [user(s)] ] [ -W job-attribute ]
PARAMETERS
-E
Forces encryption when communicating with the CUPS server, ensuring secure transmission of data.
-H
Displays the hostname and port of the CUPS server being used for printing operations.
-U username
Specifies an alternate username to use for authentication with the CUPS server, useful for administrative tasks.
-l
Provides a long listing format, showing more detailed information for printers or jobs than the default output.
-v [destination(s)]
Displays the device URI (Uniform Resource Identifier) for specified printers, indicating where they are physically connected or located on the network.
-a [destination(s)]
Reports whether specified printers are currently accepting new print jobs into their queues.
-c [class(s)]
Lists the printers that are members of the specified print classes, which group multiple printers together.
-d
Shows the default printer or print class configured for the system, which is used when no specific destination is provided.
-p [destination(s)]
Shows the current status of specified printers, including whether they are enabled, idle, or experiencing issues.
-o [destination(s)]
Lists all active print jobs in the queue for specified destinations. If no destination is given, it lists all jobs.
-r
Displays the status of the CUPS scheduler (server), indicating if it is running and processing print requests.
-s
Provides a summary of printer status, including the default printer, scheduler status, and a list of all detected printers.
-t
Displays all available status information: scheduler status, all known destinations (printers and classes), and all active jobs.
-u [user(s)]
Shows print jobs submitted by specified users. If no username is given, it lists jobs for all users.
-W job-attribute
Specifies the type of jobs to display based on their status. Common attributes include completed, not-completed, and processing.
DESCRIPTION
lpstat is a command-line utility used to display status information about the CUPS (Common Unix Printing System) printing environment.
It allows users and administrators to monitor various aspects of the printing system, including the status of printers, print classes, and individual print jobs. Users can query whether a printer is enabled and accepting jobs, retrieve reasons for a printer being unavailable, and list jobs currently in the print queue. For each job, lpstat typically shows the job ID, the user who submitted it, the file size, and its current status.
This command is invaluable for troubleshooting printing problems, checking job progress, and generally maintaining an overview of the printing infrastructure. It provides crucial insights into the operational state of the printing system.
CAVEATS
lpstat relies on the CUPS daemon (cupsd) being active and accessible. If CUPS is not running or network connectivity to the CUPS server is interrupted, the command will fail or provide incomplete information.
While lpstat -t provides a comprehensive overview, its output can be very verbose in environments with many printers or jobs. Users typically only see their own print jobs unless they have administrator privileges, in which case they can view all jobs.
COMMON USE CASES
lpstat is frequently used for quick diagnostics and monitoring of the printing system. For example, lpstat -s provides a concise summary of the default printer and scheduler status, giving a quick overview of the system's health.
To check a specific printer's operational state and identify potential issues, users often run lpstat -p printer_name. To view all active jobs currently in the print queue, lpstat -o is an essential command. For checking jobs submitted by a particular user, lpstat -u username is very helpful for both individual users and system administrators.
HISTORY
The lpstat command has its origins in the traditional System V printing system (lp), which was prevalent in Unix-like operating systems. However, with the widespread adoption of CUPS (Common Unix Printing System) as the standard printing architecture in modern Linux and other Unix-like environments, lpstat was reimplemented as an integral part of the CUPS suite.
This integration ensures seamless interaction with the CUPS daemon and its advanced features, effectively replacing older, less flexible printing solutions. Its development has mirrored the evolution of printing in Unix environments, adapting to networked printing and sophisticated printer capabilities while retaining a familiar command-line interface.