I'm using zsh and this command didn't work well. I found this post which includes something nice! Here's mine:
~% history 1 | cat | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a; }' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10 1 300 25.5537% ag 2 95 8.09199% g 3 61 5.19591% gl 4 49 4.17376% gb 5 45 3.83305% ls 6 43 3.66269% cm 7 42 3.57751% cd 8 39 3.32198% cat 9 28 2.38501% brew 10 26 2.21465% rm
ag is the command for the_silver_searcher -- I guess I search a lot!
ag
If you use zsh you can use the command zsh_stats.
zsh_stats
Nice! I didn't know about zsh_stats. It would have saved me some time tinkering with cut and uniq :P
cut
uniq
$ zsh_stats 1 828 7.84165% git 2 691 6.54418% gst 3 533 5.04783% gco 4 469 4.44171% cd 5 439 4.15759% ggpush 6 367 3.47571% gca 7 363 3.43783% grunt 8 357 3.381% ls 9 299 2.83171% npm 10 291 2.75594% make 11 288 2.72753% code 12 248 2.34871% open 13 188 1.78047% node 14 188 1.78047% hexo 15 171 1.61947% z 16 156 1.47741% brew 17 145 1.37324% ggpull 18 141 1.33535% .. 19 138 1.30694% cat 20 136 1.288% eos
Oh, that's weird it didn't work for you. I'm also using zsh. I'm just curious, what was not working with the original command?
zsh
It just shows a bunch of commands with a count of 1 :-) The zsh_stats thing is very cool!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'm using zsh and this command didn't work well. I found this post which includes something nice! Here's mine:
ag
is the command for the_silver_searcher -- I guess I search a lot!If you use zsh you can use the command
zsh_stats
.Nice! I didn't know about
zsh_stats
. It would have saved me some time tinkering withcut
anduniq
:POh, that's weird it didn't work for you. I'm also using
zsh
. I'm just curious, what was not working with the original command?It just shows a bunch of commands with a count of 1 :-) The
zsh_stats
thing is very cool!