I spend a large chunk of time working in the terminal and was curious to see what my most commonly used shell commands were. This also gave me an opportunity to practice writing one liners and learn a bit of awk.
history | cut -d' ' -f4 | awk '{a[$0]++}END{for(i in a)print i,a[i]}' | sort -k 2 -n -r
The script is simple - look through my command history, extract the first word, and count the number of times that word appears. I was surprised to see git at the top but it makes sense - I tend to run it as a sequence (git status, git commit, git push) so it leads to an inflated count. The rest make sense - they’re a mix of the standard navigation commands as well as command related to my current projects. Next step is to set up a cron job to track this usage over time and see how it changes.
Command | Frequency |
---|---|
git | 347 |
ls | 103 |
python | 89 |
fab | 70 |
cd | 49 |
ssh | 28 |
cat | 28 |
ping | 23 |
emacs | 22 |
stash | 15 |
rm | 15 |
rake | 15 |
pip | 14 |
cdblog | 14 |
pwd | 12 |
jekyll | 12 |
connectec2 | 11 |
sudo | 9 |
workon | 7 |
wc | 7 |
phantomjs | 6 |
history | 5 |
head | 5 |
c_do | 5 |
brew | 5 |
sh | 4 |
mv | 4 |
make | 4 |
grep | 4 |
sass | 3 |
redis-cli | 3 |
open | 3 |
mkvirtualenv | 3 |
find | 3 |
celery | 3 |
source | 2 |
sed | 2 |
redis-server | 2 |
mkdir | 2 |
echo | 2 |
dig | 2 |
cp | 2 |