Linux: Show your IP-address

Show IP-Address

How to get your IP-address:

ifconfig "eth0"|grep ‘inet addr’|cut -d’ ‘ -f12|cut -c6-20

and if you want to use IP-address at your own scripts just use:

INTIP=`ifconfig eth0|grep ‘inet addr’|cut -d’ ‘ -f12|cut -c6-20` echo "$INTIP"

and now you have your IP-address on $INTIP enviroment and you can use that at your scripts.

[…]

Playing with interfaces and mac-addresses on Linux

I often use laptop which have integrated wifi card and I often need external USB network card too and sometimes internal is WLAN0 and sometimes it was WLAN1 and of course opposite for that external card. That’s why it was really annoying and almost impossible to write workings scripts that used specific network interfaces.

Username […]