I need a command to list available printers in my Ubuntu.
The printers list could be installed or shared?
This list also should state the state of the printer .
Any Help to achieve my goal?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityThe Command lpstat -p
will list all available printers for your Desktop .
And whether or not they are available ( the state of them) .
If you just want the printer names:
lpstat -p | awk '{print $2}'
To see their names and print queues:
lpstat -p | awk '{print $2}' | xargs -n1 lpq -P
I need a command to list available printers in my Ubuntu.
I have bolded available because the OP presumably means that.
Neither lpstat -p
nor lpstat -t
list all printers available on the local network. Both commands only show local (often called permanent) printers. Both appear to have gained some traction as inadequate responses to the query.
As of 2022, lpstat -e
or lpstat -l -e
give all available on the local network.
For the most detailed information about all available printers including local and lan printers, you can use -t
option with lpstat
It tells you the following:
Here is the sample output
> lpstat -t
scheduler is running
system default destination: HP_Ink_Tank_Wireless_410_series_1C5045
device for Deskjet-Ink-Adv-2010-K010: hp:/usb/Deskjet_Ink_Adv_2010_K010?serial=CN12C11MQH05MB
device for HP_Ink_Tank_Wireless_410_series_1C5045: implicitclass://HP_Ink_Tank_Wireless_410_series_1C5045/
Deskjet-Ink-Adv-2010-K010 accepting requests since Saturday 30 April 2022 10:45:04 AM
HP_Ink_Tank_Wireless_410_series_1C5045 accepting requests since Monday 02 May 2022 01:54:54 PM
printer Deskjet-Ink-Adv-2010-K010 is idle. enabled since Saturday 30 April 2022 10:45:04 AM
printer HP_Ink_Tank_Wireless_410_series_1C5045 now printing HP_Ink_Tank_Wireless_410_series_1C5045-202. enabled since Monday 02 May 2022 01:54:54 PM
HP_Ink_Tank_Wireless_410_series_1C5045-202 user 679936 Monday 02 May 2022 01:54:54 PM