LinuxCommandLibrary

ipinfo

Retrieve IP address information

TLDR

Display details for your current IP address

$ ipinfo myip
copy

Display details for a specific IP address
$ ipinfo [ip_address]
copy

Display details for multiple IP addresses in bulk from a file
$ ipinfo bulk [path/to/ips.txt]
copy

Display details for a CIDR or IP range
$ ipinfo bulk [cidr_range]
copy

Display only specific fields from IP lookup results
$ ipinfo [ip_address] [[-f|--field]] [hostname,country,org]
copy

Summarize details for a group of IP addresses
$ ipinfo summarize [path/to/ips.txt]
copy

Extract IP addresses from text and highlight them
$ ipinfo grepip [path/to/file.txt]
copy

Display help
$ ipinfo [[-h|--help]]
copy

SYNOPSIS

ipinfo [OPTIONS] [IP_ADDRESS]
ipinfo [COMMAND] [ARGS...]
(Examples: ipinfo 1.1.1.1, ipinfo --json 8.8.8.8, ipinfo myip)

PARAMETERS

IP_ADDRESS
    The IPv4 or IPv6 address to look up. If omitted, it defaults to your public IP.

--token TOKEN
    Use a specific API token for authentication, enabling higher rate limits and access to more data.

--field FIELD
    Display only a specific field from the lookup result (e.g., country, org, city).

--json
    Output the results in JSON format.

--csv
    Output results in CSV format, typically used for bulk queries.

--pretty
    Pretty print JSON output for better readability.

--version
    Show the command's version information.

--help
    Show help message for the command or a subcommand.

DESCRIPTION

The ipinfo command-line interface (CLI) client provides a convenient way to retrieve detailed information about IP addresses directly from your terminal. It leverages the ipinfo.io API, a widely used service for IP geolocation, Autonomous System Number (ASN) details, company information, and more.

Users can query their own public IP address or specify any IPv4 or IPv6 address to get data such as country, region, city, postal code, latitude/longitude, ISP, organization name, and ASN. The CLI supports various output formats, including plain text, JSON, and CSV, and allows filtering for specific data fields. It's particularly useful for network diagnostics, security analysis, and automating tasks requiring IP-based data.

CAVEATS

The ipinfo command is not a standard Linux utility; it requires separate installation (e.g., via go install, package managers like brew, or pre-compiled binaries).

It relies entirely on the external ipinfo.io API for data, meaning network connectivity is essential. Free usage is subject to rate limits, and an API token is often required for higher usage and access to certain premium data fields.

Sending IP addresses to an external service might have privacy implications depending on the usage context. The accuracy of geolocation data can also vary.

SUBCOMMANDS

The ipinfo CLI supports a variety of subcommands that extend its functionality beyond simple IP lookups. These include ipinfo bulk for processing lists of IP addresses, ipinfo map to generate a map of IP locations, ipinfo myip to quickly get your own public IP, ipinfo summary for aggregate statistics, and ipinfo countries for country-specific data. Each subcommand often has its own set of options and arguments.

API TOKEN CONFIGURATION

Users can configure their API token globally using ipinfo init or by setting the IPINFO_TOKEN environment variable. This allows for consistent access to authenticated features and higher rate limits without needing to pass the --token flag for every command.

HISTORY

The ipinfo command-line client was developed by the team behind ipinfo.io, a popular IP data API service launched around 2013. The CLI tool emerged to provide developers and system administrators with a convenient, scriptable interface to their API, simplifying IP data lookups directly from the terminal without needing to write custom API calls. Its development focuses on ease of use, performance, and integrating with the evolving features of the ipinfo.io service.

SEE ALSO

curl(1), whois(1), dig(1), nslookup(1)

Copied to clipboard