05 February 2009

How to check IP In Linux

In Linux, you can use Shell Command to find or get IP address
It displays Ethernet IP address, Mac address, subnet mask and other information.
Type /sbin/ipconfig command to display IP address:

Code:

$ /sbin/ifconfig

Code:

$ /sbin/ifconfig | less


Under Solaris and other Unixish oses you may need to type ifconfig command with -a option as follows:

Code:

$ /sbin/ifconfig -a
Output sample

Code:

eth0     Link encap:Ethernet  HWaddr 00:0F:EA:91:04:07
  inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
  inet6 addr: fe80::20f:eaff:fe91:407/64 Scope:Link
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:31167 errors:0 dropped:0 overruns:0 frame:0
  TX packets:26404 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:1000
  RX bytes:38338591 (36.5 MiB)  TX bytes:3538152 (3.3 MiB)
  Interrupt:18 Base address:0xc000