Friday, October 11, 2013

Easy way to find your public IP in scripts or CLI

There is a lot of online tools that gives your public IP but most of them are either not accepting cli User-Agent or they require nasty parsing with AWK,grep,sed,etc

Best way to get your public IP address is to use which only returns the IP; simple and efficient.
 $ curl  
The only problem is the responsiveness (few seconds).

Another cool way is to query the opendns servers :
 $ dig +short
This method is pretty fast but requires the dig command (part of the bind-utils package).


  1. Nice information.I had checked my External ip address using this site

    1. That indeed works but it is not very handy if you're querying it from command line :-)