0

I know I can get the locally assigned IP address of my current machine by the local router like so:

ifconfig

However, I want to know what my IP address is as visible from the outside world. Or, in other words, the IP address of the upper-most router within my private network. Normally I could just ask Google "my ip", but I want this to be scriptable.

Is there a way to figure out this address from CLI without just scraping the results of the above Google search?

4

You can use :

curl ifconfig.me

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