How can I find out my public IP address via command line?
Nifty command for a quick lookup
Here’s a quick way to find out your public IP address via a DNS query:
nslookup / windows:
nslookup myip.opendns.com. resolver1.opendns.com
dig / Linux:
dig +short myip.opendns.com @resolver1.opendns.com
It leverages a dns server at OpenDNS to return the source IP of the request itself. Nifty for times when you don’t have a browser handy. 😄