Some sample websites that you can use with curl to display your external public IP. As you know, especially if you are connected to a router, it will provide you private IP via the DHCP and it is NAT’ed. So using ‘ifconfig’, ‘ip addr show’, ‘hostname -I’ or via the GUI won’t show the public IP.
curl ipecho.net/plain ; echo
curl ident.me ; echo
curl bot.whatismyipaddress.com ;echo
curl whatismyip.akamai.com ; echo
curl -s ipinfo.io | jq .ip #need to install jq
Or you want to challenge yourself, you can combine it with sed to do some filtering:
curl -s checkip.dyndns.org | sed -e ‘s/.*Current IP Address: //’ -e ‘s/<.*$//’