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:
npm. Here’s how to do this on Ubuntu:
curl --silent "https://api.github.com/repos/$1/releases/latest" |
grep '"tag_name":' |
sed -E 's/.*"([^"]+)".*/\1/'
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$(get_latest_release nvm-sh/nvm)/install.sh | sudo -E bash -
nvm install node --lts
whereami utility is easy:
npm install -g @rafaelrinaldi/whereami
command -v whereami
And here’s an example of how to use it with
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.