As long as you have wget or curl installed, this should work:

$ wget http://ipinfo.io/ip -qO -
  • -q – quiet mode
  • -O – – output to standard output

Or you could use cURL with the following command:

$ curl http://icanhazip.com

:D