UNIX Shell History File

Looking at history file in unix shell for a user, find 5 most often used commands.

Questions by ayongying

Showing Answers 1 - 1 of 1 Answers

Try following- it will give you top most used commands along with the count of how many times they have been used:

"history | awk '{print $2}' | sort | uniq -c | sort -nr | head -5".

Gave me following output on my machine:
166 ls
156 cd
53 pwd
21 clear
10 history

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions