Print your public IP address from Linux, macOS, FreeBSD or Unix/Windows shell:
curl https://checkip.amazonaws.com

Try dig
dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com
dig -6 TXT +short o-o.myaddr.l.google.com @ns1.google.com

See https://www.cyberciti.biz/faq/how-to-find-my-public-ip-address-from-command-line-on-a-linux/ for more.

@nixCraft

curl ipv4.is

done

@selea @nixCraft Yeah, curl is much more likely to be installed than dig...

@solarisfire

eh, neither of them are.
The point is that "curl ipv4.is" is much shorter...

@nixCraft

@selea @nixCraft Depends on the distro... I find curl more likely to be part of a base install than dig. But yeah, neither is there by default on every distro.