Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to get a list of 10 terminal commands you use most frequently in Linux

Shulou Source: shulou.com Published: 2022-06-01 20:50:25 11月14日 Update

This article will explain in detail how to get the list of 10 terminal commands you use most frequently in Linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

I think my most common command is:

Choices

Cd

Git

Ls

Ssh

Sudo

A few weeks ago I stumbled across a short Bash snippet of this Reddit thread telling me how to get a list of my most commonly used terminal commands.

History'{CMD [$2] +; count++;} END {for (an in CMD) print CMD [a] "CMD [a] / count*100"% "a;} 'column

The details are not very important, but basically, it takes the output of the history command, summarizes it, and tells you what the first ten commands are and the percentage of time spent on each command. You can easily make some modifications to the code snippet to get a longer list, or change the format slightly. This is from my recently updated laptop.

1 138 25.0909% sudo 2 59 10.7273% ls 3 47 8.54545% cd 4 20 3.63636% git 5 19 3.4545% grep 6 13 2.3636% vi 7 10 1.81818% lpstat 8 1.63636% find 9 8 1.455% ps 10 8 1.455% htop

The only thing that surprises me is lpstat (I've been struggling with printer configuration lately). These numbers are not very large, and some details are hidden behind sudo (it is likely that many of them are DNF updates). Curiously, I ran the same command on my desktop and on several virtual machines, which were used for different purposes with very different results.

What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

This is the end of this article on "how to get the 10 most commonly used terminal commands in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Tags: Commands frequently used terminals articles systems different operating systems more fragments threads details updates running good practical big same short important curious Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei OPPO Reno Shulou Technology Microsoft MySQL