Is there a console command that takes an IP address as an input and shows its geographical information like city, country, ISP, etc.?
The command is the easy part, the difficult part is having access to a database.
For example, Ubuntu has a free database with a command line query tool (
geoiplookup) in the
geoip-bin package. But it only shows country information, and uses a static (hence out-of-date) database. This tool can also query the MaxMind GeoIP database, if you have a subscription there.
There are various GeoIP databases that you can look up. They're generally meant to be viewed through a web browser, but you can look for a scraping script. For example, here's a ruby script to retrieve data from the MaxMind database. Note that scraping may be against the database's terms of service.
Here's another great option. Instructions here: http://kbeezie.com/geoiplookup-command-line/
For example, on Centos:
$ sudo yum install GeoIP GeoIP-data $ geoiplookup 22.214.171.124
And of course, you can always set this up as a cron: