← All one-liners·#014·diagnostics·self contained·beginner

What's my IP and where is it?

Free public API for your IP plus city/country/ISP/timezone. One curl, one jq, done.

The one-liner
$ curl -s https://ipapi.co/json/ \
  | jq -r '"\(.ip)\t\(.city), \(.country_name)\t\(.org)\t\(.timezone)"'
What each stage does
  1. [01] curlcurl -s https://ipapi.co/json/
    ipapi.co's anonymous endpoint — no key, ~1000 req/day per IP. Returns IP, geo, ISP, timezone, currency, calling code.
  2. [02] jqjq -r '"\(.ip)\t\(.city), \(.country_name)\t\(.org)\t\(.timezone)"'
    String interpolation: `\(.field)` inserts a field into a literal. -r emits raw text. Tab-separated so you can pipe to `column -t` if you want alignment.
Expected output (sample)
203.0.113.42	Berlin, Germany	Deutsche Telekom AG	Europe/Berlin
Caveats & tips
  • If you're behind a VPN/proxy, you see the egress IP, not your LAN IP.
  • For deeper data (ASN, postal, latitude), drop `-r` and jq the whole object.