In windows I can use ipconfig /all and this displays all the info about my connection.

In terminal using ifconfig does not and only supplies limited info. I can use network manager, but it would be useful to know the command line alternative.

So my question is: what is the command line to supply ip address, gateway, subnet mask, DNS the same way ipconfig /all supplies in Windows.

Thanks all


The only thing missing from ifconfig are the gateway and DNS servers.

15.04 and newer

To get the DNS and Gateway info just type:

nmcli dev show eth0

The output lists some device parameters including some IP4.DNS[x] entries, which show the DNS servers and a IP4.ADDRESS[1] line which lists the IP and Gateway used (look for the gw = ???.???.???.??? part at the end of the line up to 15.10). On 16.04 and newer versions there is a IP4.GATEWAY line which is pretty self explanatory.

Replace eth0 with the actual device name you're using, which may not be the same. To get a list of devices and their status type:

nmcli dev status

Up to and including 14.10

You can get these with nm-tool (in Ubuntu versions prior to 15.04) which BTW is the command line version of network manager.

To run it just type in a terminal:


If you're using Ubuntu 15.04 or newer the nm-tool has been replaced by the nmcli command which is different. Check the section called "15.04 and newer" above this one in this case.

  • 1
    Using nmcli dev show eth0 results in this: Error: 'dev' command 'show' is not valid. – Enkouyami Jul 27 '15 at 15:42
  • 1
    @Enkouyami What Ubuntu and nmcli versions are you using? – devius Jul 27 '15 at 17:51
  • 1
    @devius nmcli v0.9.8.8 on Ubuntu 15.04. – Enkouyami Jul 28 '15 at 9:33
  • 1
    @Enkouyami I'm using 0.9.10 and it works just fine. Not sure if this particular command is a new addition or not, but you can try to get help by using nmcli dev help to see which commands are available. – devius Jul 28 '15 at 10:39
  • This does not work on Linux Mint 17 based on Ubuntu 14.04. The command to use is nmcli d list which shows info for all connections, connected or not. – Deleet Jul 28 '16 at 13:23

ipconfig shows things like hostname, DNS servers, those are in a different place than just IP addresses in linux, so you will need a couple of commands.

ifconfig -a
cat /etc/resolv.conf

That shows what I want to see 99% of the time, but ipconfig /all also shows things like DHCP lease times and servers.

cat /var/lib/dhcp/dhclient.leases

Here's the simplest equivalent i could find for ubuntu 17.04

nmcli device show

Sample output (ip4 stuff only):

nmcli device show | grep IP4
IP4.ROUTE[1]:                           dst =, nh =, mt = 1000

Was looking at few links and finally found the below working:

nmcli dev list | grep IP4

The output is:

IP4.ADDRESS[1]:                         ip =, gw =
IP4.DOMAIN[1]:                          local

Also all the network related details can be found using putting simply:

nmcli dev list eth0

  • nmcli dev list | grep IP4 means take the output of nmcli dev list and then feed it (using the pipe |) into grep and keep lines that contain regex pattern IP4. – Deleet Jul 28 '16 at 13:25
  • nmcli dev list | grep IP4 doesn't work on Ubuntu 16.04 – Danibix Jan 18 '18 at 10:48

I needed to work out what DHCP server I was connected to via Ubuntu 14.04 so I used this command:

nmcli dev list|grep DHCP4

as this is what I wanted only from the original command "nmcli dev list"

DHCP4.OPTION[1]: expiry = 1464073312

DHCP4.OPTION[2]: domain_name = [omitted_proper_details]

DHCP4.OPTION[3]: broadcast_address =

DHCP4.OPTION[4]: dhcp_message_type = 5

DHCP4.OPTION[5]: dhcp_lease_time = 432000

DHCP4.OPTION[6]: ip_address =

DHCP4.OPTION[7]: subnet_mask =

DHCP4.OPTION[8]: dhcp_renewal_time = 216000

DHCP4.OPTION[9]: routers =

DHCP4.OPTION[10]: domain_name_servers =

DHCP4.OPTION[11]: dhcp_rebinding_time = 378000

DHCP4.OPTION[12]: network_number =

DHCP4.OPTION[13]: dhcp_server_identifier =

Gives me all the DCHP/DNS details I need, just like "IPCONFIG /ALL"

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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