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?

Cory Klein
  • 18,911

1 Answers1

4

You can use :

curl ifconfig.me
Rahul Patil
  • 24,711