Posts Tagged ‘curl’

What is my IP address from the command line, revisited.

March 27th, 2012 6 comments

Last year I wrote about a little script I use to query for my current IP address from the Linux CLI. dyn’s checker has served me well over the years and has been rock solid stable, which is why I chose it.

A problem has come about however whereby it is returning a private IP address ( which it is taking from the X-Forwarded-For value, rather than ignoring it purely because of the fact that it is a private (internal) IP.

I was trying to find a way to scrape Google’s what is my ip page because it doesn’t suffer from the same bug, and in the process I came about

So here is my new script, in its entirety:

echo -e "\n$(curl -s\n"

If you visit, on the bottom half of the page you will find a handful of other information you could extract. Now let’s hope that sticks around for a while.

Categories: All, Linux