Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

share|improve this question

2 Answers 2

up vote 13 down vote accepted

The only thing missing from ifconfig are the gateway and DNS servers. 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. 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).

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
share|improve this answer
this doesn't work in 15.04 – Klyn Jun 1 at 2:59
@Klyn Edited with new info for 15.04. – devius Jul 23 at 11:59
Using nmcli dev show eth0 results in this: Error: 'dev' command 'show' is not valid. – Enkouyami Jul 27 at 15:42
@Enkouyami What Ubuntu and nmcli versions are you using? – devius Jul 27 at 17:51
@devius nmcli v0.9.8.8 on Ubuntu 15.04. – Enkouyami Jul 28 at 9:33

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
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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