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

Convert A USB Cable Into A Smart Home Gadget

Get number of users on a minecraft server
I'm flat-out surprised that minecraft directory services require servers install multiple modifications to their server code, when the directories could fetch this information on their own.

Based on capsule8 agent examples, not rigorously tested

Simple MAC Changeing
The 00:11:22:33:44:55 is whatever you want your new MAC address to be. Sometimes sudo should be used in front if you need to.

List the most recent dates in reverse-chronological order

Set laptop display brightness
Run as root. Path may vary depending on laptop model and video card (this was tested on an Acer laptop with ATI HD3200 video). \$ cat /proc/acpi/video/VGA/LCD/brightness to discover the possible values for your display.

xargs for builtin bash commands
Similar to xargs -i, but works with builtin bash commands (rather than running "bash -c ..." through xargs)

Dump a configuration file without comments or whitespace...
A short, *easy-er* to remember command for stripping whitespace and comments from a config file, (or any file for that matter). Remember regex as: slash, space, star. pound, slash, bar. pointy-hat, dollar. (or "caret, dollar" if you must) :-P

ettercap..
There weren't any one liners for ettercap on this site... tisk tisk :-) (of course you'll have to plugin your own values for the variables..)

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"