Determining Your Most Used Commands in Terminal
I’m always looking to automate things using Alfred, Keyboard Maestro, Text Expander, and Python. I was curious which terminal commands I use most often, so I did some experimenting. Basically I wanted to know how many times I’ve executed each unique command (
ssh myserverx or
ssh myservery, not just
ssh). I started by piping the output of
history to
sort (to group), then to
uniq (to count), then back to
sort (to sort by the number of occurrences).
1 |
history | sort | uniq -c | sort -n |
1 |
cat ~/.bash_history | sort | uniq -c | sort -n |