Help - Search - Members - Calendar
Full Version: Retrieve public IP
linux-noob.com/forums > Linux Noob > Tips and Tricks
z0ny
Here's a command that shows your public IP, no matter whether you're behind a router: biggrin.gif

CODE
wget -q www.whatismyip.com && grep displaycopy index.html|cut -d\' -f2 && rm -f index.html


z0ny
tek-69
kick ass man, thanks
anyweb
the above scrfipt doesnt seem to work anymore, perhaps because www.whatismyip.com have changed their code, (looking in index.html tells you to use a different url)

so i modified it slightly so now it reads

CODE
wget -q www.whatismyip.com/automation/n09230945.asp && cat n09230945.asp && rm -f n09230945.asp


which does display the ip but it's badly formatted,


QUOTE
[anyweb@localhost ~]$ wget -q www.whatismyip.com/automation/n09230945.asp && cat n09230945.asp && rm -f n09230945.asp
81.235.240.204[anyweb@localhost ~]$


so who can tidy it up ?



cheers
anyweb
znx
QUOTE
so who can tidy it up ?


CODE
$ wget -q http://www.whatismyip.com/automation/n09230945.asp -O - && echo


Done
xDamox
I updated the command wink.gif

CODE
elinks --dump www.whatismyip.com | grep -i "Your IP Is" | awk '{ print $4 }'
znx
QUOTE (xDamox @ Dec 13 2007, 01:06 PM) *
I updated the command wink.gif


Not to sound a bit funny but why update the command when mine still works just perfectly? Also you are using the main URL which anyweb has already pointed out doesn't wish automation!

CODE
$ wget -q http://www.whatismyip.com/automation/n09230945.asp -O - && echo


Still works fine!
xDamox
Ahhh poo, sorry znx I didn't try yours sad.gif

Sorry.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.