Show your public IP from the command line

Having a dynamic IP-address at home, I sometimes need to lookup what my public IP is.

There plenty of choices in sites that will display your remote IP. But it’s always such a hassle. I never remember one specific site, so I always pass Google and most of the time, I don’t have a browser window open.

So this time, I searched for site that simply outputs the remote IP without any other output and added it to my bash alias list:

# Show remote ip address
alias remoteip='curl ; echo'

As you can see, I simply created an alias called remoteip. This alias runs curl and retrieves the output from the site .

The extra echo at the end is simply for formatting purposes. Of course you can use wget or any other site.