This page looks best with JavaScript enabled

Geolocate IP addresses from the command line

 ·  🎃 kr0m

There are many occasions when it is useful to obtain our IP address from the command line or to obtain information about a specific IP from a script. In this mini-howto we will use the service offered by ipinfo.io.

To use the service, it is as simple as making a web request using curl:

curl ipinfo.io

On the other hand, if we want to request information about a specific IP:

curl ipinfo.io/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.0840",
 "org": "AS15169 Google Inc.",
 "postal": "94035",
 "phone": "650"
}
If you liked the article, you can treat me to a RedBull here