By Manny Fernandez

May 11, 2020

Doing “IP Chicken” from the CLI

OK, so it is not REALLY IPChicken, but I need to equate it to something.  I use www.ipchiken.com but there are a bunch out there.  When you are on a Linux server with no GUI, you can run a command via the CLI that will tell you what public IP you are using.

Note, some minimal installs do not have dig by default.  You will need to install it.  To install it, type:

yum install bind-utils

NOTE: This is for a CentOS distribution, if you are using a Debian based, you can apt-get install instead.

dig TXT +short o-o.myaddr.l.google.com @ns1.google.com

you should see your IP as the output

e.g. 12.1.1.1

You can also use curl & if you do not have it installed, you will need to install it.  To install it, type:

yum install curl

NOTE: This is for a CentOS distribution, if you are using a Debian based, you can apt-get install instead.

curl http://ipinfo.io

2020-05-11_19-04-42.png

And thanks to Aldo Lopez, he also suggested curl ifconfig.me which is similar to the .io but more concise output without the additional info.

2020-05-11_19-05-44.png

And thanks to Matt Sherif, he also suggested using curl but with the domain of  icanhazip.com

2020-05-11_20-58-49.png

Hope this helps

Recent posts