Originally published October 28, 2020 @ 2:39 am
A handy utility by Rafael Rinaldi called whereami
allows you to geolocate an IP address directly from the command line. Here are some quick notes on installing and using this tool.
I am using Ubuntu 18.04.5 LTS running under WSL2 so there were some pre-requisites I had to install: nvm
, node.js
, and npm
. Here’s how to do this on Ubuntu:
get_latest_release() { curl --silent "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*//' } curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$(get_latest_release nvm-sh/nvm)/install.sh | sudo -E bash - source ~/.bashrc nvm ls nvm install node --lts node --verion npm --version
Installing the whereami
utility is easy:
npm install -g @rafaelrinaldi/whereami command -v whereami
And here’s an example of how to use it with dig
:
whereami $(dig +short kremlin.ru | head -1) -f human # Moscow, Moscow, Russia whereami $(dig +short whitehouse.gov | head -1) -f human # United States
Experienced Unix/Linux System Administrator with 20-year background in Systems Analysis, Problem Resolution and Engineering Application Support in a large distributed Unix and Windows server environment. Strong problem determination skills. Good knowledge of networking, remote diagnostic techniques, firewalls and network security. Extensive experience with engineering application and database servers, high-availability systems, high-performance computing clusters, and process automation.