How to get the IP address from the command line

Using OpenDNS:

dig @resolver1.opendns.com myip.opendns.com +short 'hostname' | head -1

Using other third-party services

curl ifconfig.me

If you don have a DNS set up (but you know the IP of ifconfig.me):

curl -H 'Host: ifconfig.me' 133.242.129.236

wget version:

wget --header='Host: ifconfig.me' --header="User-Agent: curl" -qO- 133.242.129.236

When ifconfig.me is too slow:

curl ip.bsd-unix.net
curl icanhazip.com
...