34

For some reason when I enter ipconfig in terminal, it just returns this:

No command 'ipconfig' found, did you mean:
 Command 'tpconfig' from package 'tpconfig' (universe)
 Command 'iwconfig' from package 'wireless-tools' (main)
 Command 'ifconfig' from package 'net-tools' (main)
ipconfig: command not found

Not quite sure what the issue is here or how to approach this

5 Answers 5

43

The Ubuntu/Linux equivalent of ipconfig in Windows is ifconfig.

Try typing sudo ifconfig.

The result will look something like this:

eth0      Link encap:Ethernet  HWaddr 00:0c:29:94:37:b6  
          inet addr:192.168.1.231  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe94:37b6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:519374 errors:0 dropped:0 overruns:0 frame:0
          TX packets:110611 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:332864737 (332.8 MB)  TX bytes:11113451 (11.1 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:33651 errors:0 dropped:0 overruns:0 frame:0
          TX packets:33651 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:2951078 (2.9 MB)  TX bytes:2951078 (2.9 MB)
3
  • 5
    I... I am an idiot. May 17, 2012 at 5:54
  • 8
    This answer was written in 2012, but already back then (and even more now), "ifconfig" was being deprecated. It should be pointed out that the "ip" command will replace it, and the more "modern" way of checking your IP would be ip addr show. More info: serverfault.com/questions/458628/should-i-quit-using-ifconfig
    – pzkpfw
    Oct 1, 2018 at 6:50
  • You don't need sudo to run ifconfig
    – cup
    Jun 20, 2020 at 7:36
9

ipconfig is a Windows program - the closest for linux is ifconfig, but contrary to what others (including the accepted "answer") are saying, it is not the same, and does not give the same output at all.

One of the key missing pieces of information in ifconfig is the DNS addresses; they are not there, and there's not an easy way to find that out. On my system, I have an alias to show some information like that:

nmcli dev list iface eth0 | grep IP4

This will list most of the information I usually want to see. On my system, it shows:

$ nmcli dev list iface eth0 | grep IP4
IP4-SETTINGS.ADDRESS:                   192.168.1.110
IP4-SETTINGS.PREFIX:                    24 (255.255.255.0)
IP4-SETTINGS.GATEWAY:                   192.168.1.1
IP4-DNS1.DNS:                           8.8.8.8
IP4-DNS2.DNS:                           8.8.4.4

Note that you may need to use a different designation for the network, such as eth1, eth2, etc. If you get an error about a device not found, try changing this.

Also note the accepted "answer" is also incorrect in that you do not need to use "sudo" for this command.

1
  • thank for a hint. nmcli dev show wlp1s0 | grep IP4 has shown me data
    – oleksa
    Feb 21, 2021 at 17:26
8

If that's the case, use ifconfig. It'll give you the same output that ipconfig will on Windows. But ifconfig is now ip a.

ifconfig

is equivalent to

ip addr show

and, because the object argument can be abbreviated and command defaults to show, also to

ip a
3
  • 1
    Would recommend just using the ip version. Using ifconfig would require installing net-tools.
    – cup
    Jun 20, 2020 at 7:34
  • This link be helpful "linuxconfig.org/…"
    – Steven
    May 10, 2021 at 7:48
  • this response is very helpful... thanks
    – ndotie
    Jun 6, 2023 at 13:25
3

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
3

I'm assuming you're looking for the command that will display the same info ipconfig does on Windows.

If that's the case, use ifconfig, part of the net-tools package. It'll give you the same output that ipconfig will on Windows.

sudo apt install net-tools

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .