SG Security Journal

Using the command line to get IP address information

11 Apr 2024


I often need to look up IP addresses to find out useful information such as the geo-location. This is how I do it from the command line.

Table of contents:

Command Line Example

From a command prompt (either CMD or Powershell) run the following command:

curl.exe ipinfo.io/8.8.8.8

More Information and Examples

You’ll notice that I used curl.exe rather than curl. This is because Powershell comes with a curl alias which I don’t like. The curl.exe is far more powerful and I prefer the output format.

If you want to get your internet facing IP address try this command:

curl.exe ipinfo.io/IP

If you get certificate errors whilst running the curl command you can use the -k command argument to override the error:

curl.exe -k ipinfo.io/8.8.8.8

Use the -v command argument for verbose output:

curl.exe -v ipinfo.io/8.8.8.8

Hope this has been useful.