Updated: 30 September 2026 · Applies to: curl and jq on any Linux server (AlmaLinux, Rocky Linux, Ubuntu, Debian and others)

To find where a server, or any IP address, is located, ask an IP geolocation service from the terminal. The result is an estimate based on registration and routing data: usually correct for the country, often only roughly right for the city, and for anycast addresses or VPNs it can be misleading. The ipvigilante.com address used in older versions of this guide no longer returned location data when we checked; the example below uses ipinfo.io, which we tested on 29 September 2026.

1. Install curl and jq

dnf install curl jq       # AlmaLinux, Rocky Linux, RHEL
apt install curl jq       # Ubuntu, Debian

2. Look up this server

curl -s https://ipinfo.io/json

Without an IP address, the service reports the public address the request came from, with fields such as ip, city, region, country, loc (latitude and longitude), org (the network owner) and timezone.

3. Look up any IP address

curl -s https://ipinfo.io/8.8.8.8/json

For 8.8.8.8 it returned "country": "US", "org": "AS15169 Google LLC" and "anycast": true: the address is served from many places, so the city says little.

4. Print only what you need

curl -s https://ipinfo.io/8.8.8.8/json | jq -r '"\(.ip) \(.city), \(.region), \(.country) \(.org)"'

A small shell function makes it reusable:

geoip() { curl -s "https://ipinfo.io/${1}/json" | jq -r '"\(.ip)\t\(.country)\t\(.city)\t\(.org)"'; }
geoip 1.1.1.1

Limits and privacy

  • Free requests without an account are limited; for scripts that look up many addresses, register for an access token and pass it as ?token=....
  • Every lookup sends the IP address to a third party. For many lookups, or for addresses you do not want to share, use a local database instead, for example MaxMind's GeoLite2 files with the mmdblookup tool (package mmdb-bin on Debian and Ubuntu).
  • To find the network owner rather than a location, whois 203.0.113.10 queries the regional internet registry directly.

Official documentation: ipinfo.io API documentation and jq manual.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket