Today, I would like to summarize some of the commands I usually use when I want to check the public IP address used by a server when connected through SSH. It’s a very simple post, yet I think that can help people at some point:
Using curl, the easiest way in my opinion:
curl ifconfig.me
Using dig and OpenDNS, way too complicated if you ask me:
dig +short myip.opendns.com @resolver1.opendns.com
Using wget, if curl is not available (that should never happen though), the file will be downloaded (index.html). You might use a command with pipe in order to get the IP address from the downloaded content:
wget http://monip.org