2

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.

How can I get this list from the command line?

Thank you.

Ryan Griggs
  • 885
  • 2
  • 12
  • 27

2 Answers2

0

It appears lpinfo -v will output a list of all detected printers, per this page.

Ryan Griggs
  • 885
  • 2
  • 12
  • 27
  • I tried `lpinfo -v` but it did not give the output I wanted. I did some research and found `lpstat -v`. See: https://serverfault.com/a/1099483/351892 – dpat Apr 26 '22 at 10:04
0

In Debian/bullseye (Debian 11) we have cups-client 2.3.3 (2.3.3op2-3+deb11u1).

lpinfo(8) states:

lpinfo - show available devices or drivers (deprecated)

And here sudo lpinfo -v lists something like this:

❯ sudo lpinfo -v
[sudo] password for jkirk: 
file cups-brf:/
network ipps
network beh
network socket
network lpd
network http
network ipp
direct hp
network https
network smb
direct hpfax

Quoting https://www.cups.org/doc/admin.html:

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.

I then finally found lpstat(1):

lpstat - print cups status information

[...]

-v [printer(s)]

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/
dpat
  • 156
  • 4