I have installed a network printer in my Ubuntu 14.04 machine by using system-config-printer. This GUI program offers a "Find network printer" function, that explores the local network. It returns a list of printers names, associated with IP adresses.

So let's say I choose one and successfully install it.

Now after a while I realize the one I installed is the wrong printer. So I do the process again, and... oh wait, there are several printers of same type (and name), with different IP adresses!

Ok, no problem, lets just check the IP of the one I just installed, so I make sure I don't install the wrong one again. So the question is: how to I get the IP of an installed printer ?

Apparently, the "properties" dialog (sample below) does not give access to this information (no, its not hidden in the URI line).

No success either by using the CUPS webserver through http://localhost:631, it seems to be basically another way of getting the same information.

Edit: the question isn't related to the printer below but is more general: as the OS is able to fetch the printer's IP at the network exploring step, I assume that information is stored somewhere. Where is it stored and how do I access it ? Or maybe it isn't stored anywhere ?

printer properties dialog


To expands on @JUH's solution above...

avahi-browse --all -t -r

Is the proper solution for autodiscover printers.

Unfortunately many printers simply don't expose their IP address in any usable form to you, the end user. This is by design. https://www.cups.org/doc/network.html

Most network printers support a protocol known as Bonjour, which is a combination of zero-configuration networking (ZeroConf), multicast DNS (mDNS), and DNS service discovery (DNS-SD) standards published by the Internet Engineering Task Force (IETF), the same group that defined TCP/IP and all of the networking we use today

Quoting the mDNS page:

When an mDNS client needs to resolve a hostname, it sends an IP multicast query message that asks the host having that name to identify itself. That target machine then multicasts a message that includes its IP address. All machines in that subnet can then use that information to update their mDNS caches. Any host can relinquish its claim to a name by sending a response packet with a time to live (TTL) equal to zero.

So to properly find the IP address of an mDNS printer, you'd need a tool capable of reading the cache.

Quoting one of the OP's comments:

Thanks. In my case, lpoptions shows indeed a lot of info, but not the IP. The concerned field looks like device-uri=hp:/net/hp_LaserJet_2420?zc=HP2420ROOMXXX, so again the same as what I get from GUI tools. So I assume the IP isn't stored in my machine...

This makes avahi-browse the best tool for the job... (or if you got here looking for a Mac utility, Apple offers one called dns-sd)

Quoting the Avahi page:

Avahi is a system which facilitates service discovery on a local network via the mDNS/DNS-SD protocol suite. This enables you to plug your laptop or computer into a network and instantly be able to view other people who you can chat with, find printers to print to or find files being shared. Compatible technology is found in Apple MacOS X (branded "Bonjour" and sometimes "Zeroconf").

Avahi is primarily targetted at Linux systems and ships by default in most distributions. It is not ported to Windows at this stage, but will run on many other BSD-like systems. The primary API is D-Bus and is required for usage of most of Avahi, however services can be published using an XML service definition placed in /etc/avahi/services.

See also the nss-mdns project, which allows hostname lookup of *.local hostnames via mDNS in all system programs using nsswitch


Using lpoptions

lpoptions  -p <printer_name> | awk '{for (i=1; i<=NF; i++) {if ($i ~ /device-uri/) {print $i}}}'


$ lpoptions  -p TOSHIBA_e-STUDIO2330C | awk '{for (i=1; i<=NF; i++) {if ($i ~ /device-uri/) {print $i}}}'

To get an overview lpinfo


$ lpinfo -v | grep -P '://'
network dnssd://HP%20LaserJet%201022n._pdl-datastream._tcp.local/
network dnssd://TOSHIBA%20e-STUDIO2540C-07279076._printer._tcp.local/
network socket://
network socket://
network socket://
network socket://
network socket://
network socket://
network socket://

or nmap

nmap -sT <adress_or_address_range>

and grep the service printer


$ nmap -sT

Starting Nmap 6.47 ( http://nmap.org ) at 2015-07-03 08:38 CEST
Nmap scan report for
Host is up (0.0017s latency).
Not shown: 991 closed ports
21/tcp   open  ftp
25/tcp   open  smtp
80/tcp   open  http
139/tcp  open  netbios-ssn
445/tcp  open  microsoft-ds
515/tcp  open  printer
631/tcp  open  ipp
8080/tcp open  http-proxy
9100/tcp open  jetdirect
  • 1
    Thanks. In my case, lpoptions shows indeed a lot of info, but not the IP. The concerned field looks like device-uri=hp:/net/hp_LaserJet_2420?zc=HP2420ROOMXXX, so again the same as what I get from GUI tools. So I assume the IP isn't stored in my machine... – kebs Jul 7 '15 at 9:46
  • Tried nmap, does its job, but doesn't return the name/type of printer that is connected. I guess that's the best I can get. – kebs Jul 7 '15 at 9:48

According to the HP Laserjet 2400-series User Guide, the IP address is available on the control panel of the printer itself.

enter image description here

  • 1
    Thanks ;-) Wasn't exactly what I expected, but useful anyway. But isn't a way to get that from the OS ? The question wasn't specifically about that printer... – kebs Jul 3 '15 at 5:29
lpstat -s

Sometimes it doesn't have to be complicated.

  • 1
    Thanks, but... no (for me). It only shows how to reach the printer: protocol and URI, for example dnssd://HP%20ENVY%205XXXX. However, it clearly shows that the IP isn't stored and how reaching the device is done. – kebs Sep 11 '18 at 9:24

Look at the arp-scan command (similar to ip neigh). You will probably have to install it:

sudo apt-get install arp-scan

And to give further detail:

sudo arp-scan --interface=eth0 --localnet

Where eth0 is your device (or wlan0 or wlp2s0). You can find your device with ifconfig or:

ip -c addr

Or try installing nmap (sudo apt-get install nmap) and type nmap substituting 192.168.1 with the first three parts of your ip address (find out using ip addr).

  • Thanks, just tried. arp-scan works fast, but it only returns MAC adress (and shows manufacturer, deduced from MAC). I'm currently trying nmap. – kebs Jul 7 '15 at 9:32
  • For nmap, it doesn't return name/type of printer, thanks anyway. – kebs Jul 7 '15 at 9:51
  • 1
    +1 to this answer: @kebs, Running Lubuntu 18.04 LTS, I use the output from ip a to get the interface (in my case not eth0), and then the arp-scan command line (of this answer) outputs the IP address, the MAC address and the name of the identified devices. – sudodus Dec 4 '18 at 12:47
  • @kebs, I booted into a live drive made from the file lubuntu-14.04.1-desktop-i386.iso, and the arp-scan command line (of this answer) outputs the IP address, the MAC address and the name of the identified device also in this case. There must be something strange with your operating system. – sudodus Dec 4 '18 at 16:32
  • nmap is slow but gets there. You need to pick out the printer port, having memorised the immediately-preceding scan report IP address, eg $ nmap -sT | awk '/report/ {ip=$5} /printer/ {print $1,ip}' – Peter Flynn Jun 13 '19 at 15:23

A bit late but this might help.

avahi-browse --all -t -r

  • 1
    Hello and welcome to AskUbuntu. Can you please explain what the command and the switches are doing? Also a link to a manpage or something similar would be nice. – Simon Sudler Sep 24 '19 at 11:48
  • Hi, thanx, as far as I understand it lists network services available. source : systutorials.com/docs/linux/man/1-avahi-browse – JUH Sep 24 '19 at 11:59

enter image description here

I am also using ubuntu14.04. If you want to see the IP of the printer which was installed, you'd better go to system settings and choose Printers. Then please choose the printer and see its properties. In the setting tab inside the properties, there is Device URI. Click on it and see the IP.

  • Thanks, but... as written in the question: no, its not hidden in the URI line. – kebs Mar 1 '19 at 10:22

This page is very informative, but it fails to describe a particular horror in the pile of unmitigated cruft that Linux printing has become. Namely, I used to have machine which I used a printer spooler on my home network. Everything was fine then (in large measure because I had configured it some while back, before things got pathologically complicated). Its name was malebranche. So, I bought another machine, and configured it, only to find that printer discovery worked remarkably badly. And, when I did lpinfo --include-schemes dnssd -v, I got (among other information) the following URI: dnssd://HP%20LaserJet%20m106w%20%40%20malebranche._ipp._tcp.local/cups?uuid=1b4bbb8c-ce03-3b73-7d72-03c9b4ce24fe

Note that it seems to be returning the URI of a printer on the machine, malebranche, which no longer exists. And it's not returning the URI of the printer on malebranche's successor, which I was trying to talk to.

I fondly remember the days when I could boast to Windows administrators about how rational Linux was, and how easy to configure. Those days are gone

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.