### Commands by ken_fallon (2) the last day the last week the last month all time sorted by date votes

• 8
history | awk '{print \$2}' | sort | uniq -c | sort -rn | head
· 2012-01-05 22:23:25
• Saves one character, the original is probably clearer Show Sample Output

1
cut -c -N
· 2011-09-26 04:46:35

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

Calculate the distance between two geographic coordinates points (latitude longitude)
The Haversine formula determines the great-circle distance between two points on a sphere given their longitudes and latitudes.

The scene in the Shining (Stanley Kubrick)
Let's take a rest. How about watch a horror? The Shining http://en.wikipedia.org/wiki/The_Shining_(film)

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

List the biggest accessible files/dirs in current directory, sorted

Recursive Ownership Change
Changing files ownership in a directory recursivley from a user to another

Finding the number of cpu's

Show most common words in filenames
I'm sure there's a more elegant sed version for the tr + grep section.

sends your internal IP by email
This is useful if you have need to do port forwarding and your router doesn't assign static IPs, you can add it to a script in a cron job that checks if you IP as recently changed or with a trigger script. This was tested on Mac OSX.

Open (in vim) all modified files in a git repository
The option --porcelain makes the output of git easier to parse. This one-liner may not work if there is a space in the modified file name.

Save your terminal commands in bash history in real time
Use this command if you want your terminal commands be saved in your history file in real time instead of waiting until the terminal is closed