3 min read

The Common UNIX Printing System (CUPS) is actually a printer management tool, and thus monitoring CUPS always remains a very essential activity to to make the best use of the resources available. Monitoring CUPS will allow us to take action quickly should something go wrong.

Using the lpstat Command

The lpstat command displays the status of the CUPS service, printers, classes, and jobs. It supports a number of options. If the command is used without any options, it displays the job queues for the current user:

$lpstat
cupstest-3 kajol 8192 Tue Aug 05 13:24:43 2008
cupstest-4 kajol 8192 Tue Aug 05 13:25:34 2008

To check whether the CUPS server is running, use the -r option.

$lpstat -r
scheduler is running
$lpstat -d
system default destination: cupsclass

The above command gives information about the default destination printer or class. The output following the command shows that the default destination of the system is cupsclass.

$lpstat -c cupsclass

This shows the printer class and the member printers belonging to that class. If a particular class is not specified, then the output shows all classes along with their member printers.

members of class cupsclass:
cupsprinter1
cupsprinter2
$lpstat -v cupsprinter2

The command above will show the device to which cupsprinter1 is attached. If no printers are specified, then the output will list all printers along with device-uri information.

device for cupsprinter2: ipp://cupsserver.cupsgroup.org/printers/cupsprinter2
$lpstat -s

This shows a status summary for all printers and classes on the network. The summary includes the default destination, a list of classes and their member printers, and a list of printers and their associated devices. The output is equivalent to using the -d, -c, and -v options simultaneously.

system default destination: cupsclass
members of class cupsclass:
cupsprinter1
cupsprinter2
device for cupsprinter1: lpd://192.168.0.11/printers/cupsprinter1
device for cupsprinter2: ipp://cupsserver.cupsgroup.org/printers/cupsprinter2
$lpstat -a

This command shows if printers are currently accepting jobs. If no printers are specified, then it will list all printers.

cupsprinter1 accepting requests since Mon 16 Jun 2008 02:28:14 PM IST
cupsprinter2 accepting requests since Wed 18 Jun 2008 11:07:23 AM IST
$lpstat -p cupsprinter1

This shows whether the printer cupsprinter1 is enabled and if it is currently printing a job. If no printers are specified then all the printers are listed.

printer cupsprinter1 is idle. enabled since Mon 16 Jun 2008 02:28:14 PM IST
$lpstat -o

This shows the job queues on the specified destinations. If no destinations are specified then all jobs are shown.

$lpstat -t

This displays status information for all printers, which is equivalent to using the -r, -d, -c, -v, -a, -p, and -o options.

scheduler is running
system default destination: cupsclass
members of class cupsclass:
cupsprinter1
cupsprinter2
device for cupsprinter1: lpd://192.168.0.11/printers/cupsprinter1
device for cupsprinter2: ipp://cupsserver.cupsgroup.org/printers/cupsprinter2
cupsprinter1 accepting requests since Mon 16 Jun 2008 02:28:14 PM IST
cupsprinter2 accepting requests since Wed 18 Jun 2008 11:07:23 AM IST
printer cupsprinter1 is idle. enabled since Mon 16 Jun 2008 02:28:14 PM IST
printer cupsprinter2 now printing cupsprinter2-5711. enabled since Wed 18 Jun 2008 03:12:55 PM IST
Printer is now on-line.
cupsprinter2-5711 kajol 1449984 Wed 18 Jun 2008 03:12:55 PM IST
$lpstat -l

This command displays printers, classes, or jobs in a long list.

$lpstat -u

This shows a list of print jobs queued by the specified users. If no users are specified, it lists the jobs queued by the current user.

cupsprinter2-5711 kajol 1449984 Wed 18 Jun 2008 03:12:55 PM IST
$lpstat -h 192.168.0.11:631

The above command specifies an alternative server for CUPS. It uses the port number that is specified along with the server. If no port is specified, then it will connect to the default port 631.

$lpstat -U username

You can specify an alternative username with the -U option

$lpstat -R : $lpstat -W all

This shows the ranking of print jobs.

This command specifies which jobs to show, complete, incomplete (the default), or all. This option must appear before the -o option and any printer names:

$lpstat -W completed -o cupsprinter2

The output will be as follows

cupsprinter2-5709 kajol 483328 Wed 18 Jun 2008 03:10:45 PM IST
cupsprinter2-5710 kajol 97280 Wed 18 Jun 2008 03:12:18 PM IST
cupsprinter2-5711 kajol 1449984 Wed 18 Jun 2008 03:12:55 PM IST
cupsprinter2-5712 kajol 8192 Wed 18 Jun 2008 03:22:31 PM IST
cupsprinter2-5713 kajol 9216 Wed 18 Jun 2008 03:23:38 PM IST
cupsprinter2-5714 kajol 9216 Wed 18 Jun 2008 03:24:23 PM IST
$lpstat -E

This command forces encryption when connecting to a print server.

LEAVE A REPLY

Please enter your comment!
Please enter your name here