### Commands tagged geographical location (12) the last day the last week the last month all time sorted by date votes

• 7
curl -s https://ipvigilante.com/\$(curl -s https://ipinfo.io/ip) | jq '.data.latitude, .data.longitude, .data.city_name, .data.country_name'
· 2019-04-26 09:15:00
• The Haversine formula determines the great-circle distance between two points on a sphere given their longitudes and latitudes. Show Sample Output

3
h(){ echo \$@|awk '{d(\$1,\$2,\$3,\$4);} function d(x,y,x2,y2,a,c,dx,dy){dx=r(x2-x);dy=r(y2-y);x=r(x);x2=r(x2);a=(sin(dx/2))^2+cos(x)*cos(x2)*(sin(dy/2))^2;c=2*atan2(sqrt(a),sqrt(1-a)); printf("%.4f",6372.8*c);} function r(g){return g*(3.1415926/180.);}';}
· 2019-04-04 01:34:36
• A function that takes a domain name as an argument Show Sample Output

2
geo(){ curl -s "http://www.geody.com/geoip.php?ip=\$(dig +short \$1)"| sed '/^IP:/!d;s/<[^>][^>]*>//g'; }
· 2009-11-12 17:14:09
• a shorter version Show Sample Output

1
· 2009-07-22 16:14:56
• geoip from maxmind try to get the small utility via: apt-get install geoip Show Sample Output

1
geoiplookup www.commandlinefu.com
· 2009-11-15 11:56:19
• Defines a function to geolocate a given IP address; if none supplied, will default to your external IP address. Show Sample Output

1
geoip() { lynx -dump "http://api.hostip.info/get_html.php?ip=\$1&position=true"; }
· 2011-05-10 21:44:07
• If used without arguments, returns own IP info. If used with argument, returns info about the parsed argument. Show Sample Output

0
geoip () { curl -s "http://www.geoiptool.com/?IP=\$1" | html2text | egrep --color 'City:|IP Address:|Country:' }
· 2009-11-15 17:59:23
• Check your local temperature based on geolocation. Show Sample Output

0
curl -s www.google.com/ig/api?weather=\$(curl -s api.hostip.info/get_html.php?ip=\$(curl -s icanhazip.com) | sed -e'1d;3d' -e's/C.*: \(.*\)/\1/' -e's/ /%20/g' -e"s/'/%27/g") | sed 's|.*<t.*f data="\([^"]*\)"/>.*|\1\n|'
· 2010-02-14 19:44:54
• Grabs the ip2location site and removes everything but the span tag containing the country value. Place it inside your .bashrc or .bash_aliases file. Show Sample Output

0
ip2loc() { wget -qO - www.ip2location.com/\$1 | grep "<span id=\"dgLookup__ctl2_lblICountry\">" | sed 's/<[^>]*>//g; s/^[\t]*//; s/&quot;/"/g; s/</</g; s/>/>/g; s/&amp;/\&/g'; }
· 2010-10-13 00:19:35
• Provides a cleaner output plus some more details about the IP address. Also, a flaw was corrected where the URL provided the results in Spanish by default. Show Sample Output

0
function geoip() { curl -s "http://www.geoiptool.com/en/?IP=\$1" | html2text | egrep --color "IP Address:|Country:|City:|Longitude:|Latitude:|Host Name:" }
· 2011-10-25 04:49:25

• 0
lynx -dump http://www.ip2location.com/ | sed -n '/^ *Field Name *Value *\$/,/^ *\[_\] *Mobile .*Carrier.*name/p'
· 2012-05-02 15:46:59
• Weather based on your location

-4
curl -s http://www.google.com/ig/api?weather=\$(curl -s "http://api.hostip.info/get_html.php?ip=\$(curl -s icanhazip.com)" | grep City | sed 's/City: \(.*\)/\1/' | sed 's/ /%20/g' | sed "s/'/%27/g") | sed 's|.*<temp_f data="\([^"]*\)"/>.*|\1\n|'
· 2010-02-13 21:42:48

### What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

### Check These Out

connects to db2 database instance/alias "stgndv2" user "pmserver" using password "xxxxxxx"

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Print a list of installed Perl modules
Works only if modules are installed "the right way"

one-liner mpc track changer using dmenu
Add a [fluxbox] binding in your key file then this command provides a dmenu selector for the next track to play

List only directories, one per line

EDIT: command updated to support accented characters! Works in any of 58 google supported languages (some sound like crap, english is the best IMO). You get a mp3 file containing your query in spoken language. There is a limit of 100 characters for the "q" parameter, so be careful. The "tl" parameter contains target language.

Squish repeated delimiters into one
This can be particularly useful used in conjunction with a following cut command like \$echo "hello::::there" | tr -s ':' | cut -d':' -f2 which prints 'there'. Much easier that guessing at -f values for cut. I know 'tr -s' is used in lots of commands here already but I just figured out the -s flag and thought it deserved to be highlighted :)

Get AWS temporary credentials ready to export based on a MFA virtual appliance
You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token. This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use: `awk '{ print "export AWS_ACCESS_KEY_ID=\"" \$1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" \$2 "\"\n" "export AWS_SESSION_TOKEN=\"" \$3 "\"" }'` You must adapt the command line to include: * \$MFA_IDis ARN of the virtual MFA or serial number of the physical one * TTL for the credentials