commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
GeoIP Needs to be installed. Can be done from some distro's or via MaxMind.com for free. There even is a free city database availabble. If the GeoLiteCity is downloaded and installed it will also find more information
geoiplookup -f /var/lib/GeoIP/GeoLiteCity.dat commandlinefu.com
GeoIP City Edition, Rev 1: US, NJ, Absecon, 08201, 39.420898, -74.497704, 504, 609
There are 6 alternatives - vote for the best!
Grabs the ip2location site and removes everything but the span tag containing the country value. Place it inside your .bashrc or .bash_aliases file.
Defines a function to geolocate a given IP address; if none supplied, will default to your external IP address.
If you can do better, submit your command here.
You must be signed in to comment.