I’ve found my self on occasion needing to find the public IP of a machine while in commandline(CLI). Most of the time its just because i’ve spoiled my self with DNS entries, and haven’t memorized it.
You need to have curl installed. If you don’t have it, it should be in your package manager. In Ubuntu its easily installed via:
sudo apt-get install curl
Then just simply run:
curl ifconfig.me
I figured since I hadn’t posted in a while, this is a useful enough tidbit to share.