Check, Show your IP address in Linux

Written by
Date: 2012-04-25 10:00:00 00:00

Small Tip: Check and show the machine IP address in Linux

ifconfig

Should give you something like:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
        inet 200.87.61.100  netmask 255.255.255.0  broadcast 200.87.61.255
        inet6 fe80::4240:74ff:fe89:aaa6  prefixlen 64  scopeid 0x20<link>
        ether 40:40:74:89:a3:bb  txqueuelen 1000  (Ethernet)
        RX packets 2318960  bytes 1318147162 (1.2 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1659847  bytes 1272644293 (1.1 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 40  

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
        inet 10.179.129.221  netmask 255.255.224.0  broadcast 10.179.159.255
     	inet6 fe80::4240:e2ff:fecd:ce8  prefixlen 64  scopeid 0x20<link>
        ether 40:40:e2:2d:0c:ea  txqueuelen 1000  (Ethernet)
        RX packets 291288  bytes 19334470 (18.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 311073  bytes 224066877 (213.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 41  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 16436  metric 1
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 10  bytes 840 (840.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10  bytes 840 (840.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

But, ifconfig is getting deprecated, so your new Linux may not have it, if that is the case use this:

ip addr show

And the ip information will show in the screen, like this:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 70:71:bc:9b:52:0e brd ff:ff:ff:ff:ff:ff
    inet 200.87.61.100/24 brd 200.87.61.255 scope global eth0
    inet6 fe80::7271:bcff:fe9b:520e/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:e0:52:b0:31:af brd ff:ff:ff:ff:ff:ff
    inet 10.1.1.2/16 scope global eth1
    inet6 fe80::2e0:52ff:feb0:31af/64 scope link 
       valid_lft forever preferred_lft forever