2020 UPDATE (Ubuntu 18+)
Still, use nmcli
as an equivalent command as Marty Fried suggests.
Coming from Windows, when you do ipconfig
you probably expect to see a bunch of information such as the network interfaces, ipv4, ipv6 addresses, dns server, default gateways etc. Unfortunately, and as Marty Fried mentions in his answer, ifconfig
is hard to extract this information (I'm not even sure it has it at all) so I would say ifconfig
and ip addr show
are not really equivalent commands to ipconfig
because they are missing all this information.
However you can use nmcli
:
nmcli dev show eth0
Explanation:
You can first list all your network interface devices to get the device name:
nmcli dev show | grep DEVICE
# output
: '
GENERAL.DEVICE: wlp5s0
GENERAL.DEVICE: br-877527cf5a41
GENERAL.DEVICE: docker0
GENERAL.DEVICE: enp3s0
GENERAL.DEVICE: veth9938f55
GENERAL.DEVICE: veth9d03338
GENERAL.DEVICE: lo
'
or to also see the network device type:
nmcli dev show | grep -E 'DEVICE|TYPE'
# output
: '
GENERAL.DEVICE: wlp5s0
GENERAL.TYPE: wifi
GENERAL.DEVICE: br-877527cf5a41
GENERAL.TYPE: bridge
GENERAL.DEVICE: docker0
GENERAL.TYPE: bridge
GENERAL.DEVICE: enp3s0
GENERAL.TYPE: ethernet
GENERAL.DEVICE: veth9938f55
GENERAL.TYPE: ethernet
GENERAL.DEVICE: veth9d03338
GENERAL.TYPE: ethernet
GENERAL.DEVICE: lo
GENERAL.TYPE: loopback
'
In my case I'm only interested in my wifi so i'm going to use the GENERAL.DEVICE
name of my GENERAL.TYPE: wifi
and:
nmcli dev show wlp5s0
# output
: '
GENERAL.DEVICE: wlp5s0
GENERAL.TYPE: wifi
GENERAL.HWADDR: 34:DE:1A:6D:9B:51
GENERAL.MTU: 1500
GENERAL.STATE: 100 (connected)
GENERAL.CONNECTION: room-501
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/1
IP4.ADDRESS[1]: 192.168.8.101/24
IP4.GATEWAY: 192.168.8.1
IP4.ROUTE[1]: dst = 0.0.0.0/0, nh = 192.168.8.1, mt = 600
IP4.ROUTE[2]: dst = 169.254.0.0/16, nh = 0.0.0.0, mt = 1000
IP4.ROUTE[3]: dst = 192.168.8.0/24, nh = 0.0.0.0, mt = 600
IP4.DNS[1]: 192.168.8.1
IP4.DOMAIN[1]: lan
IP6.ADDRESS[1]: fe80::710e:1bee:cdb4:e281/64
IP6.GATEWAY: --
IP6.ROUTE[1]: dst = ff00::/8, nh = ::, mt = 256, table=255
IP6.ROUTE[2]: dst = fe80::/64, nh = ::, mt = 256
IP6.ROUTE[3]: dst = fe80::/64, nh = ::, mt = 600
'
Here's a function you can add to ~/.bashrc
or ~/.bash_aliases
:
function ipconfig() {
for i in `seq 1 100`; do printf "-"; done; echo "";
nmcli dev show $1 | grep -E 'DEVICE|TYPE|HWADDR|MTU|STATE|CON|ADDRESS|GATEWAY|ROUTE|DNS|DOMAIN|^$' | awk '!NF{for(i=0; i<=100; i++) printf "-";}1';
for i in `seq 1 100`; do printf "-"; done; echo "";
}
Usage:
ipconfig # show details of all devices
ipconfig eth0 # show only details of eth0