Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A fun shell script from #euruku
$ history | awk {'print $2, $3, $4'} | sort | uniq -c | sort -k1 -rn | head -n 30
610 git status
568 git commit -m
491 git add .
252 git push origin
176 bundle
138 rails s
128 ls
120 git commit --amend
114 git reset --hard
109 rvm use 1.9.3
104 cd ..
103 mvim Gemfile
94 rake db:migrate
90 git log
75 rails c
74 rake
70 rake test
68 bundle exec rake
67 git push heroku
63 git fetch origin
58 exit
49 git checkout master
44 git rebase -i
41 bundle update
40 git rebase origin/master
40 cucumber
38 git diff
38 git checkout -b
37 rspec
35 irb
@b4mboo
Copy link

b4mboo commented Aug 20, 2012

Maybe I should answer that:

I told people at eurucamp 2012 in Berlin to go ahead and type that command into their shell just to get some insight on what they are doing over and over again and what they might be able to automate. I decided to collect only two words of every typed command to be able to merge all git commit -m calls into one entry on the list. Of course it is arbitrary, but it worked very well for me. Feel free to play with it as much as you want. It's all about introspection and getting to know ones own habits and workflows.

For example, another fun thing might be to see which commands are executed the most in a row (just leave out the first sort):
history | awk {'print $2, $3, $4'} | uniq -c | sort -k1 -rn | head -n 30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment