Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
Finding the Public IP address in a shell script

For use in scripting, it would be handy to be able to do this:

IP=`....something ....`
echo ...$IP... >> configfile

I'm looking for the IP address as seen by the web, in this instance. Ubuntu, if it makes a difference. Happy to install a package or two.

share|improve this question

marked as duplicate by Michael Hampton, EEAA, mdpc, Zoredache, kce Feb 5 '13 at 3:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Thanks - I looked for dupes but didn't find. –  Steve Bennett Feb 5 '13 at 22:47

1 Answer 1

up vote 3 down vote accepted
IP=`curl ifconfig.me`

[stephan@nemesis] ~ $ curl ifconfig.me
173.13.169.18

Voila. :)

share|improve this answer
    
I'd suggest, ifconfig.me returns (to curl) only the IP address without any header or body tags. –  Stephan Feb 5 '13 at 2:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.