How To Find Your Public IP Address From The Terminal

How To Find Your Public IP Address From The Terminal

Tags :

Category : How-to

Get Social!

ip-address-deconstructionFinding the IP address of your local machine couldn’t be easier – ipconfig on Windows or ifconfig on Linux will bring up all of your local network interfaces and list the IP addresses associated with them. Finding out your public IP address, which is the IP addresses associated with your internet connection can be a little more tricky.

Whatsmyip will show your your public IP address on their webpage when you visit them. Perhaps more interestingly, when visited with Linux curl or wget only the IP public address is displayed without any HTML or other content around it.

You can therefore use curl to read your public IP address into a variable, and then use it in as you need to.


Related posts:


4 Comments

Jason Murray

24-Oct-2015 at 5:14 am

I belive you were looking for ifconfig on Linux

    james.coyle

    24-Oct-2015 at 1:57 pm

    No, this only shows the local IP address for the interface (eth0, for example) which is unlikely to be your public IP address.

      John Ball

      15-Nov-2015 at 10:39 am

      I think you misunderstood Jason’s point. You stated that ipconfig on Windows or Linux will bring up all of your local network interfaces and list the IP addresses associated with them. That’s true for Windows but in Linux the closest equivalent command is ifconfig.

        james.coyle

        16-Nov-2015 at 9:47 am

        You’re right, I totally misunderstood. I’ve updated the article, thanks guys.

Leave a Reply

Visit our advertisers

Search

Quick Poll

What type of VPN protocol do you use?

Visit our advertisers