You are not logged in.
Pages: 1
I can see my network ips (192.x.x.x) fine w/ifconfig and such but how can I show my public ip in shell?? Other than lynx and going to whatismyip.com or some such method, perhaps a script or app, thx
P.S. I tried my-ip from AUR but I think it's abandoned, the makepkg could not find the archive for dling.
TIA for any help everyone
Offline
I can see my network ips (192.x.x.x) fine w/ifconfig and such but how can I show my public ip in shell?? Other than lynx and going to whatismyip.com or some such method, perhaps a script or app, thx
P.S. I tried my-ip from AUR but I think it's abandoned, the makepkg could not find the archive for dling.
TIA for any help everyone
Try this command
wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -d: -f 2 | cut -d\< -f 1
That's straight out my bashrc. You could use any other website that you like as well.
Last edited by Inxsible (2008-08-18 21:19:57)
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
Wow, that works perfect, that's awesome! Hate to prod but would you mind explaining that command a little bit?? I tried substituting "http://www.whatismyip.com" but got a bunch of random lines from the site.
Thx so much!
Offline
shorter one:
echo `wget -q -O - http://www.whatismyip.org`
Offline
Ooh that works too, more than one way to skin a cat huh? Thx!
Offline
hrhr, it's always easier as you think :>
to avoid these "random lines" you use the -q (quiet) option and -O prints the output not in a file but in your console
Last edited by arch0r (2008-08-18 21:37:40)
Offline
There is a specific page on whatismyip that is to be used for scripts to save bandwidth. Please use this page instead. http://whatismyip.com/automation/n09230945.asp
archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson
Offline
Wow, that works perfect, that's awesome! Hate to prod but would you mind explaining that command a little bit?? I tried substituting "http://www.whatismyip.com" but got a bunch of random lines from the site.
Thx so much!
The .com gives you an html page with all the fancy formatting. If you just want the ip address on console it would be much better to use the .org extension or the automation link that rson provided. They both amount to the same thing.
Note that if you use arch0r's command, you will get a bunch of HTML tags if you use the dyndns site. Suffice to say that every site (which tells you your IP address) has a different way of responding to a request. They send out data in different formats so you will have to customize your command according to the output given by the website that you plan on using.
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
There is a specific page on whatismyip that is to be used for scripts to save bandwidth. Please use this page instead. http://whatismyip.com/automation/n09230945.asp
Ah, well now that's nice to know. Thanks!
Offline
That's super useful - thanks!
That looks like a much better way of trying to do what I was trying to do than trying to do what I was trying to do...
Offline
Yes thanks rson451, that's great!
Offline
Curl is the easiest, by far:
$ curl www.whatismyip.org
Enjoy.
Offline
Pages: 1