Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there a console command that takes an IP address as an input and shows its geographical information like city, country, ISP, etc.?

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

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 Install 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.

share|improve this answer
    
just used the ubuntu geoiplookup and it is good enough. –  BuZain Feb 15 '11 at 17:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.