How do I get the name of a network printer?

0

If I have the IP address of a network printer, how can I get its name using the command line? With the GUI tool system-config-printer the printer's name and IP address shows up in the list.

August Karlstrom

Posted 2013-10-19T19:29:13.113

Reputation: 187

Have you tried lpinfo -v -h ${ip_addres}:631? – Cristian Ciupitu – 2013-10-19T20:25:06.790

@CristianCiupitu Thanks for the input but this gives me the same output as lpinfo -v; the socket URI with the IP address is displayed but not the name of the printer. – August Karlstrom – 2013-10-19T20:41:13.760

ping -a should work, among other things. – Debra – 2013-10-20T00:33:13.417

@Debra ping -a gives me the same output as without the -a, i.e. no hostname. – August Karlstrom – 2013-10-20T14:59:21.087

Good to know, though odd -- "ping -a xxx.xxx.xxx.xxx" is supposed to resolve the address to the hostname, and I often use it that way. Perhaps because it's http? – Debra – 2013-10-21T02:32:10.323

Answers

1

nmap surely accomplishes the tas, see the line http-title

$ nmap -A -T5 192.168.73.10

Starting Nmap 6.00 ( http://nmap.org ) at 2013-10-19 23:58 CEST
Nmap scan report for 192.168.73.10
Host is up (0.068s latency).
Not shown: 875 closed ports, 122 filtered ports
PORT     STATE SERVICE    VERSION
7/tcp    open  echo
80/tcp   open  http       HP Color LaserJet 2600n http config 4.0.2.38
|_http-title: HP Color LaserJet 2600n
9100/tcp open  jetdirect?
Service Info: Device: printer

Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 161.86 seconds

MariusMatutiae

Posted 2013-10-19T19:29:13.113

Reputation: 41 321

Very likely that you didn't wait long enough for the nmap command to complete. The following command took nearly ten minutes at my office network:

nmap -A -T5 175.30.4.1/24 2>&1 | tee nmapscan.out – Troy Folger – 2017-03-14T22:13:42.427

When I run the nmap command it never seems to complete. The only output I get is Starting Nmap 6.40 ( http://nmap.org ) at 2013-10-20 16:52 CEST – August Karlstrom – 2013-10-20T14:56:13.167

You have a connectivity problem in your LAN, not a problem with your printer. – MariusMatutiae – 2013-10-20T15:01:18.760

How come the GUI tool system-config-printer can get the name of the printer then? – August Karlstrom – 2013-10-21T11:19:40.530