Ubuntu – How to get the current location/coordinates by IP from the command line

command line

It seems like there is a package called geoclue which uses Mozilla's location service to lookup wireless access points and their known location, but there doesn't seem to be a command line interface for this. Is there another way to do it? Any clever hacks?

Best Answer

If you want IP based lookup... (but you'll have to fix the HTML formatting of the output)

wget http://cqcounter.com/whois/my_ip_address.php && egrep "IP Location|City|Latitude|Longitude" my_ip_address.php