Reputation:
I want to find out which are the top 5 commands that I ran in the shell. I want to see which commands I use most often. It would be great if I can also see how often I ran these top commands.
Is there an easy way to find it without installing any plugins?
Upvotes: 0
Views: 610
Reputation: 1519
You can do it using history command and combine it with head -n
to get the top n commands.
To get the top 5 commands:
history | awk '{print $2}' | sort | uniq -c | sort -rn | head -5
Result:
69 cd
66 ls
41 vi
40 git
24 rm
This means I have used cd
most often, and I have used it 69 times.
Upvotes: 2