wheresthatip
v1.0.1
Published
Look up IP address geolocation from the command line. Get IP, city, country, ISP, and coordinates instantly.
Maintainers
Readme
wheresthatip
IP geolocation from the command line. Look up any IP address to get city, country, ISP, and coordinates.
$ wheresthatip
IP 203.0.113.42
City San Francisco
State California
Country United States
ISP Comcast Cable Communications
Coordinates 37.7749, -122.4194
Details: https://www.wheresthatip.com/ip/203.0.113.42Install
npm install -g wheresthatipUsage
Show your public IP and location
wheresthatipLook up any IP address
wheresthatip 8.8.8.8
wheresthatip 1.1.1.1Output as JSON
wheresthatip --json
wheresthatip 8.8.8.8 --json{
"ip": "8.8.8.8",
"city": "Mountain View",
"state": "California",
"country": "United States",
"isp": "Google LLC",
"latitude": 37.386,
"longitude": -122.0838
}Get just the IP (for scripting)
wheresthatip --raw
# 203.0.113.42
# Use in scripts:
MY_IP=$(wheresthatip --raw)Use as a library
const { myip, lookup } = require('wheresthatip');
// Get your public IP
const ip = await myip();
console.log(ip); // "203.0.113.42"
// Look up any IP
const info = await lookup('8.8.8.8');
console.log(info.country); // "United States"
console.log(info.city); // "Mountain View"
console.log(info.isp); // "Google LLC"API
myip()
Returns a Promise<string> with your public IP address.
lookup(ip)
Returns a Promise<Object> with geolocation data:
| Field | Type | Description |
|-------|------|-------------|
| ip | string | The IP address |
| city | string | City name |
| state | string | State/region name |
| country | string | Country name |
| isp | string | Internet Service Provider |
| latitude | number | Latitude coordinate |
| longitude | number | Longitude coordinate |
| postal | string | Postal/ZIP code |
Options
| Flag | Description |
|------|-------------|
| -j, --json | Output as JSON |
| -r, --raw | Output IP address only |
| -h, --help | Show help |
| -v, --version | Show version |
Powered by
WheresThatIP.com — Free IP geolocation, network tools, and privacy resources.
- What Is My IP? — See your public IP and location
- IP Lookup — Look up any IP address
- DNS Lookup — Query DNS records
- Ping Test — Test connectivity
- Best VPNs — Protect your IP with a VPN
License
MIT
