View all files | ||||
This is the official CLI for the IPinfo.io IP address API, allowing you to:
The ipinfo CLI is available for download via multiple mechanisms.
OR to install the latest amd64 version without automatic updates:
Note: this installs our full suite of binaries and keeps them up-to-date.
Note: this is a one-time installation; updates are not automatic. Use the PPA for automatic updates.
OR
where {arch} can be 386, amd64, arm, or arm64.
Note: run powershell as administrator before executing this command.
To save the CLI's config, add -v "/path_to_config:/root/.config/ipinfo". For example, the following command saves the config to the ipinfo directory in the current working directory.
Make sure that $GOPATH/bin is in your $PATH, because that's where this gets installed:
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):
After choosing a platform PLAT from above, run:
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:
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:
Replace <path> with the required location.
The ipinfo CLI has some subcommands like grepip, grepdomain, matchip, prips, cidr2range, cidr2ip, range2cidr, range2ip, splitcidr, randip and mmdb which are also shipped as standalone binaries.
These binaries are available via all the same installation methods as mentioned above for ipinfo, except you must change only the name to the name of the subcommand, and choose the appropriate version.
Currently these subcommands are separately shipped:
| grepip | 1.2.3 |
| grepdomain | 1.0.0 |
| matchip | 1.0.0 |
| prips | 1.0.0 |
| cidr2range | 1.2.0 |
| cidr2ip | 1.0.0 |
| range2cidr | 1.3.0 |
| range2ip | 1.0.0 |
| randip | 1.1.0 |
| splitcidr | 1.0.0 |
| mmdb | 1.4.2 |
This will help you quickly get started with the ipinfo CLI.
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.
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/tools/summarize-ips:
There are many more features available, so for full details, consult the -h or --help message for each command. For example:
Auto-completion is supported for at least the following shells:
NOTE: it may work for other shells as well because the implementation is in Golang and is not necessarily shell-specific.
Installing auto-completions is as simple as running one command (works for bash, zsh and fish shells):
If you want to customize the installation process (e.g. in case the auto-installation doesn't work as expected), you can request the actual completion script for each shell:
If your shell is not listed here, you can open an issue.
Note that as long as the COMP_LINE environment variable is provided to the binary itself, it will output completion results. So if your shell provides a way to pass COMP_LINE on auto-completion attempts to a binary, then have your shell do that with the ipinfo binary itself (or any of our binaries).
The amount of data you get back per lookup depends upon how much data you have enabled on your token via the https://ipinfo.io site.
If you have an account, see our plans and addons.
All examples in this document use a token with all data enabled.
All our CLIs respect either the --nocolor flag or the NO_COLOR environment variable to disable color output.
To enable color support for the Windows command prompt, run the following to enable Console Virtual Terminal Sequences.
You can disable this by running the following:
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, VPN detection, hosted domains, and IP type data sets. Our API handles over 40 billion requests a month for 100,000 businesses and developers.