Quantcast
Channel: Linux by Examples » sort
Viewing all articles
Browse latest Browse all 4

what is your 10 common linux commands?

$
0
0

Dear command line ninjas, Mr CLI and keyboard pianist:

What is your regular command you use? I am sure you must thinking of ls and cd. Yeah, they are common for every users, but how about the rest of them? I have construct a combos of commands to help you identify your top ten linux command.

The idea is simple, we gather info from history, lets look at the command combo’s now.

history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl |  head -n10

The command line above may looks complected, let me briefly explain it part by part. Awk is the most important part in line above, It simply store the command and count the occurrence in history ( column 2, $2), at the end of operation, it prints the result accordingly. Check out awk examples for more illustration on awk.

With the result output it then passes to grep -v to filter out “./”, because ./something is not a linux command. After that, arrange the data in columns and sort it numerically. List only the top ten with numbers using head and nl.

I have also created a script, so you can download it and run.

The results might vary based on your daily activities and Linux distribution. I have two laptop, one i use it at home and another one I use it at office. Ok, here is my 10 common linux commands.

Linux Distro: kubuntu 7.10
Desc: My personal laptop.
Activities: Online, Blogging, and leisure stuff.


     1  97  19.4%  ls
     2  78  15.6%  cd
     3  46  9.2%   vi
     4  27  5.4%   sudo
     5  25  5%     apt-get
     6  15  3%     ps
     7  13  2.6%   rm
     8  13  2.6%   ll
     9  11  2.2%   man
    10  8   1.6%   mv



Linux Distro: Ubuntu 7.04
Desc: Office Laptop
Activities: coding in c/c++, testing on the modules coded.


     1  94  18.8%  vi
     2  83  16.6%  g++
     3  77  15.4%  ls
     4  69  13.8%  cd
     5  11  2.2%   ps
     6  10  2%     man
     7  8   1.6%   sudo
     8  6   1.2%   apt-get
     9  5   1%     cp
    10  4   0.8%   vis

From the result above, you may realized that, I use vi and g++ more than cd and ls during working.

p.s. vis is alias vis=’sudo vi’

Share with us your top ten command :)

Best Regards,
mysurface.


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images