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.
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 "[email protected]".
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
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
ipdata 126.96.36.199 --fields ip,country_code,threat.is_tor,asn.name