19 Aug
2013
19 Aug
'13
2:23 p.m.
/sbin/ifconfig $1 | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}'
To make it a bit less ancient: ======== /bin/ip -o addr show | grep inet | awk '{print $4}' | awk -F/ '{print $1}' or just for eth0: /bin/ip -o addr show eth0 | grep inet | awk '{print $4}' | awk -F/ '{print $1}' ======== This might be an interesting article to read, regarding ifconfig: http://inai.de/2008/02/19 Further interesting peace of information regarding linux/iptables (section 'Mythbusting time') see: http://inai.de/links/iptables/ I hope this information may be usefull to you. -- EL