Running the ipdata
command without any parameters will look up the IP address of the computer you are running the command on. Alternatively you can explicitly look up your own IP address by running ipdata me
. You can filter the JSON response with jq
to get any specific fields you might be interested in.
ipdata
or
ipdata me
Use jq
to filter responses to get specific fields of interest.
ipdata me | jq .country_name
You can pass any valid IPv4 or IPv6 address to the ipdata
command to look it up. In case an invalid value is passed you will get the error Error: No such command "1..@1....1..1"
.
ipdata 8.8.8.8
ipdata 2607:fb90:b94a:4b87:0:e:6e58:7801
In case you don't want to use jq
to filter responses to get specific fields you can instead pass a fields argument to the ipdata
command along with a comma separated list of valid fields. Invalid fields are ignored. It is important to not include any whitespace in the list.
To access fields within nested objects eg. in the case of the asn
, languages
, currency
, time_zone
and threat
objects, you can get a nested field by using dot notation with the name of the object and the name of the field. For example to get the time_zone name you would use time_zone.name
, to get the time_zone abbreviation you would use time_zone.abbr
ipdata 8.8.8.8 --fields ip,country_code,threat.is_tor,asn.name