Need to know your public IP?
Some times you may need to know your public IP address. With this simple command you can find it out:
$ curl -s http://checkip.dyndns.org/ | egrep -o "[0-9.]+"
There are some other sites where we can discover it like whatismyip or whatismyipaddress, but the user-agent needs to be spoofed beacuse they ban curl, so the solution is using the -A option:
$ curl -A "Mozilla/4.0" -s http://whatismyip.com
With the above command you will get the entire page bypassing the ban. But as the HTML of this pages is more complex and we do not want to fool them spoofing the user agent, we prefer ...