Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there way any I can see the how many number of times A command has got executed in my terminal with count on it ?

Thank you.

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

Open your terminal and type as

history | awk '{a[$2]++} END { for  ( i in a ) { print a[i] " " i}}' | sort -rn | head

Then that will give you most executed commands in your terminal.

For example:

raja@debian:~$ history | awk '{a[$2]++} END { for  ( i in a ) { print a[i] " " i}}' | sort -rn | head
45 sudo
20 firefox
10 ./configure
9 ls
9 ./hotspot.sh
9 cd
8 nano
6 su
5 man
4 vmstat
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.