curl --silent https://myipv4.p1.opendns.com/get_my_ip | jq --raw-output '.ip'
curl --silent https://eth0.me
curl --silent https://ifconfig.me/ip
curl --silent https://ipecho.net/plain
curl --silent https://ipinfo.io/ip
dig @resolver4.opendns.com myip.opendns.com +short
That last one is generally much faster than the rest.
Also, you can add -w '\n'
to curl commands to make it add a newline.