Skip to content

Instantly share code, notes, and snippets.

@menski
Created August 23, 2014 20:54
Show Gist options
  • Save menski/71c3cfe734c1d7fb05ea to your computer and use it in GitHub Desktop.
Save menski/71c3cfe734c1d7fb05ea to your computer and use it in GitHub Desktop.
Command line to print current ip geolocation
function whereami {
curl -sb -H "Connection: close" http://freegeoip.net/csv/ | tr -d \" | awk 'BEGIN{FS=","} {printf "%-6s: %s\n%-6s: %s %s, %s (%s %s)\n%-6s: %s, %s\n", "ip", $1, "city", $7, $6, $5, $3, $2, "coords", $8, $9}'
}
#!/bin/sh
curl -sb -H "Connection: close" http://freegeoip.net/csv/ | tr -d \" | awk 'BEGIN{FS=","} {printf "%-6s: %s\n%-6s: %s %s, %s (%s %s)\n%-6s: %s, %s\n", "ip", $1, "city", $7, $6, $5, $3, $2, "coords", $8, $9}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment