Explore our IP Address Database Downloads for instant access to our IP address insights

Learn more
  1. IPinfo
  2. Blog
  3. IPinfo CLI: See the location of IPs on a map
IPinfo CLI: See the location of IPs on a map
2 years ago by IPinfo Team 5 min read

IPinfo CLI: See the location of IPs on a map

Many of IPinfo’s users use our IP mapping tool to paste up to 500,000 IPs and retrieve a map of customers or other website visitors. Our CLI makes this tool even easier for developers to use.

How organizations use our mapping tool

Visualizing IPs on a map is important for many reasons. Here are a few ways our customers use this CLI command:

  1. Plot the locations of customers
  2. Determine nationality, demographics, and more for ad viewers
  3. Visualize where website visitors originate
  4. Customize analytics reports
  5. Integrating to analytics dashboards
  6. Monitoring network and request activity at various levels, regions and countries
  7. Identify security threats or origins of abuse

In other words, IPinfo’s CLI commands simplify IP mapping for business intelligence, security analytics, firmographics, and more. These are just a few ways IPinfo’s users utilize our IP mapping tool.

Check out our Abusive IP 🗺 sample map to see this mapping visualizer in action.

What formats does the data need to be in?

We automatically extract IP addresses from raw text, such as server access logs. You don’t need to filter any IP information.

If you are using our IP mapping tool our sophisticated IP address detection models will strip out all the texts and extract only valid IP addresses from the input field. For example -

IPinfo CLI Usage

IPinfo CLI’s map command is one of its most useful features. It utilizes IPinfo’s mapping tool.

IPinfo CLI’s map command accepts:

  • IP addresses (8.8.8.0)
  • IP ranges (129.134.0.0-129.134.0.254)
  • CIDRs (157.240.231.0/24)
  • File paths to files that contain list of IP addresses

And you can even pipe IP address information to it.

How to map a single IP address

To map a single IP address on the interactive map, you can run the command -

$ ipinfo map 8.8.8.0

<https://ipinfo.io/tools/map/4aa0ed25-b6ba-4991-81c1-a1e54eaeb1fa>

Running the command will automatically open up your web browser and will visit the generated URL. You can even copy the URL and share it.

If you want to see your IP address location on the map, you can run -

$ ipinfo myip -f ip | ipinfo map

Here you are piping your ip address field to the map command after getting your IP address data with the myip command.

Mapping CIDR and IP Address Range

CIDR stands for “Classless Inter-Domain Routing” which represents a block of IP addresses.

For example, the CIDR of 157.240.194.0/24 contains 256 individual IP address ranging from 157.240.194.0, 157.240.194.1, 157.240.194.2…..157.240.194.254, 157.240.194.255.

Now to map all the IP addresses under a CIDR you don’t have to write them one by one. IPinfo CLI’s map command accepts CIDRs directly and can map all the IP addresses within that block.

The command to map all the individual IP addresses under a CIDR block is -

$ ipinfo map 157.240.194.0/24

<https://ipinfo.io/tools/map/66d3079b-541c-46bb-b049-43f9360564ff>

This command maps all the 256 IP Addresses within the CIDR block of 157.240.194.0/24.

You can also map IP ranges with the map command-

$ ipinfo map 8.8.8.0-8.8.8.255

<https://ipinfo.io/tools/map/cfebb47f-2e21-4db6-8cae-274ba184f867>

Passing text files containing IP addresses

IPinfo CLI’s map command allows you to pass text files that contain one or more IP addresses. This is specially helpful when it comes to mapping server logs containing IP addresses.

The ips.txt here contains 500 randomly generated IP addresses on a text file. The IPinfo CLI takes only mere moments to map all these IP address geolocation points on a interactive map.

$ cat ips.txt

127.110.160.148
191.172.131.23
185.123.6.232
8.207.28.128
...
86.234.165.133
128.131.1.21
164.81.151.182
44.98.78.106
219.137.168.161

$ ipinfo map ips.txt

<https://ipinfo.io/tools/map/9333c850-cb7e-4592-b204-69efde2bdb16>

Mapping multiple sources simultaneously

IPinfo CLI supports bulk lookup operations out of the box. This holds true even for mapping IP addresses. You can provide multiple IP addresses, CIDRs, IP ranges and even multiple text files.

Mapping multiple IP addresses at the same time:

$ ipinfo map 20.54.0.255 69.53. 224.255 69.63.187.18

<https://ipinfo.io/tools/map/a3933ce7-cba1-48a7-91ce-edbe3b99e3ff>

Mapping multiple CIDR at the same time -

$ ipinfo map 20.54.0.0/24 69.63.187.0/24

<https://ipinfo.io/tools/map/b33d229d-3547-4722-83d1-c5ce3232b5b9>

Passing multiple files containing list of IP addresses

$ ipinfo map ips_1.txt ips_2.txt

And last but not least passing everything all at once (!):

$ ipinfo map 8.8.8.0-8.8.8.255 1.1.1.0/30 123.123.123.123 ips.txt

<https://ipinfo.io/tools/map/e4aea183-ba9b-457e-bf48-5f4b903a69b3>

Getting started with IPinfo's CLI

All CLI binaries (e.g. ipinfo, grepip, map IPs) are available for download from multiple mechanisms. See https://github.com/ipinfo/cli#installation for full details.

IPinfo is a comprehensive IP address data and API provider with flexible pricing plans to meet your business needs. We handle billions of API requests per month, serving data like IP geolocation, VPN detection, ASN, and more. Sign up for a free account or contact our team to learn more.