Public IPv4 addresses are assigned by NIC and belong to CIDR blocks that are unique to the entire internet.
In this little post, I show many ways to find your public IP address form the Linux terminal.
Using Curl
You can curl it from IP websites:
$ curl ifconfig.me
You might want to get more details (such as remote_host) with:
$ curl ifconfig.me/all
Other destination that also works: ipinfo.io/ip. Curling ipinfo.io is also great to get information about the Geographical Location of a provided IP address.
Using wget
Similarly to curl:
$ wget http://observebox.com/ip -O - -q ; echo
Using dig and host
Another nice way to find the IP:
$ host -t a dartsclink.com | sed 's/.*has address //'
dig +short myip.opendns.com @resolver1.opendns.com
If you use DynDNS
Finally, if you have a DynDNS configuration:
$ curl -s http://checkip.dyndns.org/ | grep -o "[[:digit:].]\+"
:)