How to grep and display IP Address on Linux

How to find out an IP Address on Linux is pretty simple by type “ifconfig” command.

Output:

# ifconfig
eth0 Link encap:Ethernet HWaddr 01:2A:A1:3C:C3:27
inet addr:192.168.1.23 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:256125364 errors:0 dropped:0 overruns:0 frame:0
TX packets:203700834 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:240597045 (229.4 Mb) TX bytes:3399069596 (3241.6 Mb)
Interrupt:16 Memory:f8000000-f8011100

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:4760967 errors:0 dropped:0 overruns:0 frame:0
TX packets:4760967 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:480898269 (458.6 Mb) TX bytes:480898269 (458.6 Mb)

For some reason, you may want to display IP Address only. You can do it on multiple way and here you go:
Read more

Possibly Related Posts:


Planet Malaysia

  • Follow us on Twitter


  • web www.planetmy.com