lundi 2 février 2015

print IP address with interface name


I want to show the IP address like below



lo : 127.0.0.1
eth0 : 192.168.5.123
eth1 : 192.172.0.212
wlan0 : 10.1.0.124


I'm able to print all IP address by ifconfig | awk '/inet addr/{print substr($2,6)}'. But it is only printing the IPs. Every system have their own interface names and addresses. So my script has to show their interfaces with respect to IP addresses.



Aucun commentaire:

Enregistrer un commentaire