The other day I had to ssh into a RedHat Linux server to help a friend. My friend wanted to find the public IP address using Linux command line. This is simpler than what I imaged.

After having one of my favorite Latin America coffee from Peru I was able to find the answer. Use these simple commands after opening your Terminal/Command line on Linux:

  • Using the dig command type:
    • dig +short myip.opendns.com @resolver1.opendns.com
  • or you can use this one:
    • dig TXT +short o-o.myaddr.l.google.com @ns1.google.com

You can now see your public IP address on your Linux terminal.

Find Public IP Address using Linux
Find Public IP Address using Linux

Leave a comment

Your email address will not be published.