### Commands tagged gps (4) the last day the last week the last month all time sorted by date votes

• This oneliner uses Imagemagic's identify utility to show the exif GPS information of an image an also converts Grad/MIn/Sec representation to a decimal degree number Show Sample Output

5
identify -verbose my_image.jpg | awk 'function cf(i){split(i,a,"/");if(length(a)==2){return a[1]/a[2]}else{return a[1]}}/GPS/{if(\$1~/GPSLatitude:|GPSLongitude:/){s=\$0;gsub(/,/,"",\$0);printf("%s (%f)\n", s, \$2+cf(\$3)/60+cf(\$4)/3600)}else{print}}'
· 2022-02-20 10:17:49
• gps data from geocaching.com is provided for free in .loc format.

3
gpsbabel -D 0 -i geo -f "/path/to/.loc" -o garmin -F usb:
· 2009-04-27 15:46:37
• 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
• Converts a single-track KML (Keyhole Markup Language) file to a GPX file. KML is the geospatial format of choice used by Google Earth, but doesn't interoperate with other GIS applications, websites, or devices ? almost all of which accept GPX.

0
gpsbabel -i kml -f in.kml -o gpx -F out.gpx
· 2010-12-22 07:04:41

### 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

"Pretty print" \$PATH, show directories in \$PATH, one per line with replacement pattern using shell parameter expansion
Can be used to create path alias. From: https://www.cyberciti.biz/tips/bash-aliases-mac-centos-linux-unix.html. #9

tcpdump from src to dst
then open with wireshark

Alias for getting OpenPGP keys for Launchpad PPAs on Ubuntu
Makes it easy to add keys to new ppa sources entries in apt sources.list Now to add the key for the chromium-daily ppa: \$ launchpadkey 4E5E17B5

Save a file you edited in vim without the needed permissions
probably just like 1204, but uses tee as a filter (+ I actually understand how this one works)

Watches the headers of a curl, following any redirects and printing only the HTTP status and the location of the possible redirects.

Brute force discover
Show the number of failed tries of login per account. If the user does not exist it is marked with *.

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

Find the package that installed a command

Copy a file from a remote server to your local box using on-the-fly compression
-P displays a progress meter -z tells rsync to use compression

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="\$1" D=\$(( SS / 86400 )) H=\$(( SS % 86400 / 3600 )) M=\$(( SS % 3600 / 60 )) S=\$(( SS % 60 )) [ "\$D" -gt 0 ] && echo -n "\${D}:" [ "\$H" -gt 0 ] && printf "%02g:" "\$H" printf "%02g:%02g\n" "\$M" "\$S" }