Skip to content

Instantly share code, notes, and snippets.

@colehocking
Last active February 14, 2024 17:15
Show Gist options
  • Select an option

  • Save colehocking/40cae24330067aa6440ca817b08119b7 to your computer and use it in GitHub Desktop.

Select an option

Save colehocking/40cae24330067aa6440ca817b08119b7 to your computer and use it in GitHub Desktop.
Open Google Maps for an IP address
#!/bin/bash
# Open Google Maps for an IP address;
# requires jq
# Replace "firefox" with "open" for OSX
# requires osescript for the "open" command.
IP=$1
COOR=$(curl -s http://ipinfo.io/${IP} | jq .loc)
MAP="https://maps.google.com/maps?q=${COOR}"
echo "Opening map for: ${IP}"
echo "Coordinates: ${COOR}"
firefox "${MAP}" 2>/dev/null &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment