terminal-iconA lot of us use the command line on a regular basis, be it to do some simple package management with apt or monitor system resources with top.

Have you ever wondered which commands you use most often? There’s an easy way to find out.

Run the following command in a new terminal window to see a list of your 10 most used terminal commands (and a small tally of how often you’ve used each):

history | awk '{print $2}' | sort | uniq -c | sort -rn | head -10

Naturally these stats aren’t of any real practical value. And if you regularly clear the bash cache it may not even be hugely accurate.

It also doesn’t count complete commands (e.g, ‘sudo apt update‘).

But for curiosity’s sake it can be interesting to see which single commands you enter most often.

My results show I’ve used the command ‘cd‘ (used for moving between directories) most often, at a rather puzzling 1,245 times since installing Ubuntu 16.04 LTS!

Second was ‘sudo‘, and third, with a more modest runtime tally of 345 is ‘top‘.

Want to see more than 10 commands? Just edit the number at the end of this command to the number of commands you’d like to see (e.g, -14 to see the top 14, and so on).

What are yours?

How To terminal