//View Tip #304
Similar Tips
» Overwrite a file with zeroes
» Bash efficiency formula ;-)
» Tar remote dir over SSH
» Generate a random password
» Calendar with today colored [handle single digit dates]


Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
# by dj.r4iden
echo "Your ip Address is" `lynx --source http://www.formyip.com/ |grep The | awk {'print $5'}`

View Comments »


Add your comment

Comments are currently disabled
why not just use ifconfig and sed|awk?
Posted 2008-09-19 03:22:25
Because generally you need to be root to use ifconfig.
Posted 2008-09-19 04:29:15
ifconfig eth0 | sed '/inet addr:/!d' | awk {'print $2'} | sed 's/addr://'
Posted 2008-09-19 12:43:48
Or another way:
as a .bashrc alias
alias myip="links -dump http://www.formyip.com/ | grep \"Your IP\" | \
   sed 's/^[ \t]*//'"

ifconfig will only give you the local IP, you might be NAT'd and want to find the external IP of the network you're on.
Posted 2008-10-02 23:30:59
ah, NAT, you scoundrel.
Posted 2008-10-03 18:37:54

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit