CUPS - how to list all detected printers from command line (Linux)
772
In the CUPS web interface, when adding a printer, the interface displays all detected printers, both local and networked, and the user can pick which one they want to add to CUPS.
The lpadmin(8) program is used to add, modify, or delete destinations, while the lpinfo(8) command is used to list the available printer drivers and backends. The cupsctl(8) program is used to manage the printing system as a whole, including things like debug logging and printer sharing.
So lpinfo is (1) deprecated and only lists "the available printer drivers and backends" which is not what we need.
Shows the printers and what device they are attached to. If no
printers are specified then all printers are listed.
And this gives me the list of attached / configured printers (as listed in http://localhost:631/printers/) :
❯ lpstat -v
device for Brother_MFC-L3750CDW_series: dnssd://Brother%20MFC-L3750CDW%20series._ipp._tcp.local/?uuid=e3248000-80ce-11db-8000-b4220042d121
device for HP_Color_LaserJet_MFP_M477fdw: socket://10.17.0.8
device for HP_DeskJet_4720_series: socket://192.168.178.33
device for HP_LaserJet_4200: socket://192.168.178.33
device for Lexmark_Lexmark_T630_himalia: ///dev/null
device for SHARP_MX-5140N: dnssd://MX-5140N%20(4503825900)._printer._tcp.local/
It appears
lpinfo -v
will output a list of all detected printers, per this page.In Debian/bullseye (Debian 11) we have cups-client 2.3.3 (2.3.3op2-3+deb11u1).
lpinfo(8) states:
And here
sudo lpinfo -v
lists something like this:Quoting https://www.cups.org/doc/admin.html:
So
lpinfo
is (1) deprecated and only lists "the available printer drivers and backends" which is not what we need.I then finally found lpstat(1):
And this gives me the list of attached / configured printers (as listed in http://localhost:631/printers/) :