This is the official CLI for the IPinfo.io IP address API, allowing you to:
- Look up IP details in bulk or one-by-one.
- Look up ASN details.
- Summarize the details of up to 1000 IPs at a time.
- Open a map of IP locations for any set of IPs.
- Filter IPv4 & IPv6 addresses from any input.
- Print out IP lists for any CIDR or IP range.
- And more!
All CLI tools (e.g. ipinfo
, grepip
) are available for download via
multiple mechanisms.
brew install ipinfo/tap/ipinfo-cli
OR to install the latest amd64
version without automatic updates:
curl -Ls https://github.com/ipinfo/cli/releases/download/ipinfo-1.1.1/macos.sh | sh
curl -Ls https://github.com/ipinfo/cli/releases/download/ipinfo-1.1.1/deb.sh | sh
OR
curl -LO https://github.com/ipinfo/cli/releases/download/ipinfo-1.1.1/ipinfo_1.1.1.deb
sudo dpkg -i ipinfo_1.1.1.deb
Make sure that $GOPATH/bin
is in your $PATH
, because that's where this gets
installed:
go get github.com/ipinfo/cli/ipinfo
The pre-built binaries for all platforms are available on GitHub via artifacts in releases. You need to simply download, unpack and move them to your shell's binary search path.
The following OS & arch combinations are supported (if you use one not listed on here, please open an issue):
darwin_amd64
darwin_arm64
dragonfly_amd64
freebsd_amd64
freebsd_arm
freebsd_arm64
linux_amd64
linux_arm
linux_arm64
netbsd_amd64
netbsd_arm
netbsd_arm64
openbsd_amd64
openbsd_arm
openbsd_arm64
plan9_amd64
plan9_arm
solaris_amd64
windows_amd64
windows_arm
After choosing a platform PLAT
from above, run:
# for Windows, use ".zip" instead of ".tar.gz"
curl -LO https://github.com/ipinfo/cli/releases/download/ipinfo-1.1.1/ipinfo_1.1.1_${PLAT}.tar.gz
# OR
wget https://github.com/ipinfo/cli/releases/download/ipinfo-1.1.1/ipinfo_1.1.1_${PLAT}.tar.gz
tar -xvf ipinfo_1.1.1_${PLAT}.tar.gz
mv ipinfo_1.1.1_${PLAT} /usr/local/bin/ipinfo
Installing from source requires at least the Golang version specified in
go.mod
. You can install the Golang toolchain from
the official site.
Once the correct Golang version is installed, simply clone the repository and install the binary:
git clone https://github.com/ipinfo/cli ipinfo-cli
cd ipinfo-cli
go install ./ipinfo/
$GOPATH/bin/ipinfo
You can add $GOPATH/bin
to your $PATH
to access ipinfo
directly from
anywhere.
Alternatively, you can do the following to output the binary somewhere specific:
git clone https://github.com/ipinfo/cli ipinfo-cli
cd ipinfo-cli
go build -o <path> ./ipinfo/
Replace <path>
with the required location.
Clone the git repository.
git clone https://github.com/ipinfo/cli ipinfo-cli
cd ipinfo-cli
Build the image
docker build -t ipinfo-cli:latest .
Run the docker image
docker run -it ipinfo-cli:latest sh
By default, invoking the CLI shows a help message:
If you have a token, log in with it first. You can continue without a token, but there will be limited data output and some features (like bulk lookups) will not be available. Get your token for free at https://ipinfo.io/signup.
ipinfo login
You can quickly look up details of your own IP with myip
:
You can see the details of any IP by specifying it:
You can pipe IPs in and get their results in bulk (this requires a token):
Here's the CSV version of that:
In case you only needed a single field from a bunch of IPs:
The above commands implicitly run the bulk
subcommand on the input. You can
manually specify bulk and input IPs on the command line:
IP details can be summarized similar to what's provided by https://ipinfo.io/summarize-ips:
There are many more features available, so for full details, consult the -h
or --help
message for each command. For example:
ipinfo 8.8.8.8 --help
All our CLIs respect either the --nocolor
flag or the
NO_COLOR
environment variable to disable color
output.
There are official IPinfo client libraries available for many languages including PHP, Python, Go, Java, Ruby, and many popular frameworks such as Django, Rails and Laravel. There are also many third party libraries and integrations available for our API.
See https://ipinfo.io/developers/libraries for more details.
Founded in 2013, IPinfo prides itself on being the most reliable, accurate, and in-depth source of IP address data available anywhere. We process terabytes of data to produce our custom IP geolocation, company, carrier and IP type data sets. Our API handles over 12 billion requests a month for 100,000 businesses and developers.