Comment

Comment by coderholic

Not strictly a curl hack, but you can quickly get your IP geolocation details with curl and http://ipinfo.io (full disclosure, it's my service):

  $ curl ipinfo.io
  {
    "ip": "208.54.39.206",
    "hostname": "mce2736d0.tmodns.net",
    "city": "Los Angeles",
    "region": "California",
    "country": "US",
    "loc": "34.0522,-118.2437",
    "org": "AS21928 T-Mobile USA, Inc.",
    "postal": "90013",
    "phone": 213
  }
  
Or just your IP

  $ curl ipinfo.io/ip
  208.54.39.206
  
Or any other field (eg. city)

  $ curl ipinfo.io/city
  Los Angeles
  
Or lookup another 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.0838",
    "org": "AS15169 Google Inc.",
    "postal": "94040",
    "phone": 650
  }
Or a specific field for that IP:

  $ curl ipinfo.io/8.8.8.8/org
  AS15169 Google Inc.
parent coderholic 11 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton