Linux : Finding your public IP from the command line

By | July 1, 2018

You are probably used to all these “get my IP” or “find my IP” kind of site, which show your external / Internet IP on a Web page.

However you might be facing some challenge if you are on a CLI only kind of machine. Fortunately there is a few ways to find your public IP from the console, here are two easy ones :

1. Use cURL toward our simple IP page :

2. Use the “DIG” DNS utility if it is present on your system, by querying OpenDNS servers :

NOTE : DIG is usually a part of “dns-utils” package on modern Linux systems.

Be Sociable, Share!