Ubuntu – How to find the network IP address, netmask, and gateway info


I'm trying to make my IP address static as I hear it fixes slow browsing issues.

When I click on connection information under the networking menu of the gray taskbar, it tells me about the IP address, subnet mask, and DNS, but nothing about the gateway.

I would like to know if there's a terminal command to find the information.

Best Answer

I have this command as an alias for "ipconfig" (up to 14.04):

nmcli dev list iface eth0 | grep IP4

An example listing is:

IP4-SETTINGS.PREFIX:                    24 (

If eth0 doesn't work, you may need to use eth1, eth2, ... depending on your configuration.

EDIT: 2/8/16

Note that this only works in versions before v15.04 (or possibly before v14.10; I have v14.04). For newer versions, you can use this:

 nmcli dev show eth0
Related Question