Get your external IP Address on Command Line

Posted on Saturday November 15, 2014 / by Eric Potvin

You can use either curl or wget to get your external (or public) IP address from the command line. Both tools will output the same results. In this article we will use curl.

Now, when you want to know your external IP address in command line, you do not want to see anything other than your IP address. You don't want to see HTML code and waste time looking for your IP.

For example, you can run this command:

curl mxtoolbox.com/WhatIsMyIP/

This will output the entire HTML page including your IP address. Now try to find it! Not fun right?

To fix this issue, you can use one of these sites:

For example:

curl -s bot.whatismyipaddress.com; echo;

Better right?