Search code examples
apibashgeolocation

How to get my geolocation in bash


I am looking for a good geolocation api to use from bash. I want this call to return at the very minimum the name of the city I am in, and the state.

I imagine that there must be some site I can curl, or some scripting language that has a package that works. The machine does not have a GPS, but it does use wireless internet most of the time if that is needed.


Solution

  • I was looking at this problem again recently and found whereami, a geolocation bash script for Mac OS X Snow Leopard, which takes advantage of Core Location. This will tend to be much more precise than IP geolocation, and it works well in my tests.