How to get to know you Ubuntu server public IP
When come to configure server, we always want to know what’s our server public IP is in order to whitelist or configure the security access to it, when using Widnow server, you may easily open your browser and browse to the website such as http://www.ip2location.com or http://www.whatismyip.com to get to know your public IP.
In Linux CLI environment you don’t have such as facility to doing so, you may need to using command line to query and doing some filtering in order to get your server public IP.
The following are few of the way where you may query and check what’s your server Public IP:
dig +short myip.opendns.com @resolver1.opendns.com
dig TXT +short o-o.myaddr.l.google.com @ns1.google.com
dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'"' '{ print $2}'
curl ifconfig.me
curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
curl ipinfo.io/ip
curl icanhazip.com
curl ipecho.net
wget -qO- http://ipecho.net/plain ; echo
wget -qO- icanhazip.com