How to get your public IP address from the terminal
Came across this little command the other day. This does a simple GET request to http://ifconfig.me, which returns your IP address.
curl ifconfig.me
There are also a few other commands that can give you other information including your hostname, user agent, etc. You can get it return in json, xml or plain text. I encourage you to checkout http://ifconfig.me on the web to see them all.
There are a few services to retrieve your public facing IP address, but I think this one is the nicest/easiest to remember.
From: http://jjbohn.info/cheat-sheet/how-to-get-your-public-ip-address-from-the-terminal/
Written by John Bohn
Related protips
3 Responses

This has already been shared, but it's good nonetheless. :)
icanhazip.com responds a lot faster here. Same script-friendly format. :)

I usually use curl ipecho.net/plain
Thanks for sharing anyway!