Get Your Public IP from the Linux Terminal
Via DNS (works even when outbound HTTP is filtered):
dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | tr -d '"'
dig +short myip.opendns.com @resolver1.opendns.com
Via HTTP:
curl -s ifconfig.me
curl -s https://api.ipify.org
Force IPv4 or IPv6 with curl -4 / curl -6.