Linux and Unix lpstat command
Lists status of the LP print services.
lpstat displays status information about the current classes, jobs, and printers. When run with no arguments, lpstat will list jobs queued by the current user.
lpstat is now part of the Common Unix Printing System (CUPS). You may need to install CUPS before using lpstat, and related tools such as lpr.
sudo apt-get update && sudo apt-get install cups cups-client lpr
This will install the Common Unix Printing System on your system. You should now be able to set up CUPS by directing any web browser to the address: http://localhost:631
Doing so will open a web-based CUPS configuration screen, which should look something like this:
Then, from the command line, add your user to the group lpadmin with the command:
sudo adduser <yourusername> lpadmin
This will add you to the group of users allowed to administer printers on your system.
You should now be able to check the status of your printers and your print jobs by using lpstat.
lpstat [ -E ] [ -H ] [ -U username ] [ -h hostname[:port] ] [ -l ] [ -W which-jobs ] [ -a [ destination(s) ] ] [ -c [ class(es) ] ] [ -d ] [ -o [ destination(s) ] ] [ -p [ printer(s) ] ] [ -r ] [ -R ] [ -s ] [ -t ] [ -u [ user(s) ] ] [ -v [ printer(s) ] ]
|-E||Forces encryption when connecting to the server.|
|-H||Shows the server hostname and port.|
|-R||Shows the ranking of print jobs.|
|-U username||Specifies an alternate username; runs lpstat as if you were user username. This option requires superuser privileges.|
|-W which-jobs||Specifies which jobs to show, completed or not-completed (the default). This option must appear before the -o option and/or any printer names, otherwise the default (not-completed) value will be used in the request to the scheduler.|
|-a [printer(s)]||Shows the accepting state of printer queues. If no printers are specified then all printers are listed.|
|-c [class(es)]||Shows the printer classes and the printers that belong to them. If no classes are specified then all classes are listed.|
|-d||Shows the current default destination.|
|-h server[:port]||Specifies an alternate server.|
|-l||Shows a long listing of printers, classes, or jobs.|
|-o [destination(s)]||Shows the jobs queue on the specified destinations. If no destinations are specified all jobs are shown.|
|-p [printer(s)]||Shows the printers and whether or not they are enabled for printing. If no printers are specified then all printers are listed.|
|-r||Shows whether the CUPS server is running.|
|-s||Shows a status summary, including the default destination, a list of classes and their member printers, and a list of printers and their associated devices. This is equivalent to using the "-d", "-c", and "-v" options.|
|-t||Shows all status information. This is equivalent to using the "-r", "-d", "-c", "-v", "-a", "-p", and "-o" options.|
|-u [user(s)]||Shows a list of print jobs queued by the specified users. If no users are specified, lists the jobs queued by the current user.|
|-v [printer(s)]||Shows the printers and what device they are attached to. If no printers are specified then all printers are listed.|
Display all printer information. Output will resemble the following:
scheduler is running system default destination: PDF device for Lexmark_Pro700_Series: usb://Lexmark/Pro700%20Series?serial=90T7099T1914144&interface=1 device for PDF: cups-pdf:/ Lexmark_Pro700_Series accepting requests since Mon 18 Aug 2014 03:46:06 PM EDT PDF accepting requests since Sun 17 Aug 2014 09:51:41 PM EDT printer Lexmark_Pro700_Series disabled since Mon 18 Aug 2014 03:46:06 PM EDT - Unplugged or turned off printer PDF is idle. enabled since Sun 17 Aug 2014 09:51:41 PM EDT
Display all installed printers. Output will resemble the following:
printer Lexmark_Pro700_Series disabled since Mon 18 Aug 2014 03:46:06 PM EDT - Unplugged or turned off printer PDF is idle. enabled since Sun 17 Aug 2014 09:51:41 PM EDT
Display only those printers which are currently accepting print requests. Output will resemble the following:
Lexmark_Pro700_Series accepting requests since Mon 18 Aug 2014 03:46:06 PM EDT PDF accepting requests since Sun 17 Aug 2014 09:51:41 PM EDT
Note that printers which are currently powered off will still accept requests; these requests will simply remain in the queue until the device is powered on, or the request is removed with lprm.
Displays which printer is currently the default. Output will resemble the following:
system default destination: Lexmark_Pro700_Series
Display all active print jobs. Output will resemble the following:
Rank Owner Job Files Total Size 1st hope 1 budget.txt 2315 bytes 2nd hope 2 /home/hope/docs/userlist.txt 5452 bytes 3rd hope 4 (standard input) 52954 bytes 4th hope 5 /tmp/vroAdm2/1 5827 bytes
cancel — Cancels a print job under the System V operating system.
lp — Print a file on the System V operating system.
lpq — List the status of available printers.
lpr — Submit print requests.
lprm — Remove requests from the print queue.