Created
August 23, 2014 20:54
-
-
Save menski/71c3cfe734c1d7fb05ea to your computer and use it in GitHub Desktop.
Command line to print current ip geolocation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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