Skip to content

Instantly share code, notes, and snippets.

@dhoeric
Last active April 20, 2018 06:05
Show Gist options
  • Save dhoeric/78e0dab712cc4529c0ce to your computer and use it in GitHub Desktop.
Save dhoeric/78e0dab712cc4529c0ce to your computer and use it in GitHub Desktop.
Get geographic location by IP address #scripts
# Put into .bashrc, source .bashrc, (max. 1000 requests per day)
# Example:
# $ ip2geo 8.8.8.8
# {
# "ip": "8.8.8.8",
# "hostname": "google-public-dns-a.google.com",
# "city": "Mountain View",
# "region": "California",
# "country": "US",
# "loc": "37.3860,-122.0838",
# "org": "AS15169 Google Inc.",
# "postal": "94040"
# }
ip2geo () { /usr/bin/curl ipinfo.io/$@ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment