I have this one liner that returns IP address for ethernet, wireless and ppp
Code: Select all
/sbin/ifconfig|grep -iE 'Bcast|P-t-P'|tr -s ' '|tr ' ' ':'|cut -d ':' -f4
Oh, and the reason it calls the full path to ifconfig is that /sbin is not usually in an ordinary user's path. (works in debian, slackware).
TIA