what is your 10 common linux commands?

October 27th, 2007 mysurface Posted in awk, column, Common, grep, head, history, nl, sort | Hits: 88224 | 37 Comments »

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.

37 Responses to “what is your 10 common linux commands?”

  1. Interesting, by a fair margin, ssh is top on my list

    1 34 25.9542% ssh

    Which goes to show that when I go to the CLI that it’s to do work on servers which is how I have setup my environment. On those servers real or virtual then, by a wide margin also, is screen(1) which most remote (or even CLI) users should run first.

  2. wine on a suprisingly high position here since i tried to get a small program working in a real os. sudo is very much apt-get. ping is because of problems with my connection….

    1 83 16.6% cd
    2 77 15.4% ls
    3 67 13.4% sudo
    4 23 4.6% exit
    5 20 4% df
    6 19 3.8% cat
    7 14 2.8% wine
    8 13 2.6% ping
    9 11 2.2% ssh
    10 10 2% java

  3. Mine is probably quite strange to a lot of people; ls isn’t even on the list because I have my shell (zsh) set up to automatically run “ls” after every “cd”. So I don’t end up typing “ls” unless I want to do something odd, like sort by size.

    1 328 32.4111% python
    2 204 20.1581% vi
    3 150 14.8221% less
    4 67 6.62055% cd
    5 39 3.85375% cp
    6 26 2.56917% grep
    7 24 2.37154% sudo
    8 17 1.67984% cat
    9 9 0.896414% wc
    10 8 0.795229% find

    You might also be able to tell that I do a lot of Python development. :)

  4. 1 222 44.4% sudo
    2 48 9.6% ping
    3 43 8.6% cd
    4 20 4% dir
    5 17 3.4% audacious
    6 12 2.4% compiz
    7 10 2% killall
    8 8 1.6% make
    9 7 1.4% wget
    10 6 1.2% opera

  5. 1 99 19.8% cd
    2 95 19% ls
    3 30 6% less
    4 23 4.6% sudo
    5 22 4.4% vim
    6 17 3.4% exit
    7 16 3.2% man
    8 15 3% df
    9 13 2.6% fg
    10 10 2% mv

    Nice. I just realize I should simply type ‘vi’ instead of ‘vim’. And you can tell who worrying about the disk space recently. ;-)

  6. 1 275 27.5% ssh
    2 99 9.9% sudo
    3 61 6.1% ping
    4 55 5.5% cd
    5 50 5% ls
    6 43 4.3% host
    7 24 2.4% less
    8 21 2.1% wget
    9 20 2% route
    10 20 2% cat

  7. [...] 转载 & 修改自:http://linux.byexamples.com/archives/332/what-is-your-10-common-linux-commands/ [...]

  8. blackbelt_jones Says:

    so what do you to get this output? I’m dying to find out what my results will be.

  9. Did you even read the article blackbelt_jones? It’s the command right under: The idea is simple, we gather info from history, lets look at the command combo’s now.

  10. blackbelt_jones Says:

    No, I didn’t read the article, sorry, but if there’s a link up there somewhere, it’s real easy to miss.

  11. blackbelt_jones Says:

    oooooooh, there it is. Thanks.

  12. blackbelt_jones Says:

    1 36 25.7143% sudo
    2 24 17.1429% ls
    3 21 15% cd
    4 12 8.57143% startx
    5 10 7.14286% mplayer
    6 6 4.28571% emacs
    7 5 3.57143% cp
    8 4 2.85714% date
    9 2 1.42857% su
    10 2 1.42857% man

  13. 1 101 20.2811% cd
    2 85 17.0683% ls
    3 57 11.4458% sudo
    4 28 5.62249% javac
    5 27 5.42169% java
    6 22 4.41767% mencoder
    7 15 3.01205% make
    8 13 2.61044% wine
    9 11 2.20884% svn
    10 10 2.00803% md5sum

    Yeah, I do a lot of Java programming in the command line

  14. 1 42 19.4444% cd
    2 37 17.1296% ls
    3 32 14.8148% sudo
    4 18 8.33333% rm
    5 12 5.55556% mplayer
    6 7 3.24074% mv
    7 6 2.77778% cat
    8 5 2.31481% df
    9 5 2.31481% clear
    10 4 1.85185% man

    Currently watching too much anime. Need a lot of space for that

  15. In a recently installed debian:

    1 93 25.4098% cd
    2 86 23.4973% ls
    3 28 7.65027% su
    4 18 4.91803% sudo
    5 15 4.09836% exit
    6 12 3.27869% cat
    7 10 2.73224% make
    8 10 2.73224% gksudo
    9 9 2.45902% ping
    10 7 1.91257% traceroute

  16. 1 395 39.5% ls
    2 110 11% cd
    3 50 5% vim
    4 44 4.4% ll
    5 40 4% exit
    6 30 3% view
    7 29 2.9% clear
    8 20 2% su
    9 20 2% ps
    10 19 1.9% echo

  17. I am an entry level C programmer. Therefore the gcc command is very much in use at the moment.

    1 110 22% gcc

    2 64 12.8% cd

    3 56 11.2% ls

    4 50 10% emacs

    5 18 3.6% make

    6 14 2.8% sudo

    7 12 2.4% exit

    8 11 2.2% mv

    9 9 1.8% fisygradis

    10 6 1.2% ftp

  18. basicly i use my laptop for everything…programming admining my server blogs mail everything so here is my list

    1 134 26.8% sudo
    2 47 9.4% exit
    3 36 7.2% ssh
    4 28 5.6% vi
    5 19 3.8% mutt
    6 19 3.8% ls
    7 17 3.4% startx
    8 17 3.4% cd
    9 13 2.6% screen
    10 13 2.6% mplayer

    startx is there because i prefere to not have some kind of login manager but rather login and start it i just think it makes it easyer

  19. Interesting, thanks ;)

    Recently installed Debian Etch as a server test field (as root) :
    1 50 23.1481% vim
    2 30 13.8889% ls
    3 25 11.5741% apt-get
    4 13 6.01852% ifconfig
    5 9 4.16667% mount
    6 9 4.16667% aptitude
    7 7 3.24074% cp
    8 6 2.77778% mkdir
    9 6 2.77778% chmod
    10 5 2.31481% exit

    Mandriva personnal desktop (also as root) :
    1 115 11,5% urpmi
    2 76 7,6% vim
    3 62 6,2% urpmq
    4 60 6% mount
    5 48 4,8% e2fsck
    6 46 4,6% service
    7 46 4,6% exit
    8 42 4,2% umount
    9 42 4,2% ls
    10 37 3,7% tail
    urpmi is to install while urpmq is to search anything about any package
    mount/umount coz’ I sometime like to mount external devices by hand
    e2fsck as a result after lots of issue with removable devices (eSata Sata2 & IDE HDDs) that causes freezes untill I shifted from Sata2 to IDE setting in the Bios (Asrock Dual s939)
    service might be for activating/deactivating of the display manager

  20. Nice little script. Here’s mine

    1 105 21% l
    2 60 12% cd
    3 57 11.4% sudo
    4 32 6.4% rm
    5 21 4.2% ..
    6 19 3.8% ssh
    7 19 3.8% la
    8 16 3.2% ping
    9 14 2.8% emacs
    10 10 2% ps

    These are aliases:

    l = ls
    la = ls -la
    .. = cd ..

  21. 1 747 37.35% w
    2 381 19.05% tail
    3 97 4.85% mailq
    4 84 4.2% iftop
    5 76 3.8% df
    6 75 3.75% dmesg
    7 61 3.05% netstat
    8 50 2.5% cd
    9 46 2.3% screen
    10 45 2.25% mc

  22. 1 94 18.8% gcc
    2 47 9.4% man
    3 25 5% sudo
    4 25 5% ls
    5 22 4.4% watch
    6 21 4.2% vi
    7 21 4.2% grep
    8 20 4% ps
    9 19 3.8% cd
    10 9 1.8% find
    with watch i am monitoring my system like:
    watch -n 5 netstat -l
    watch -n 5 netstat -nl
    watch -n 5 netstat -plantu
    Nice blog ;). Keep it up!

  23. Its awesome :)

    Mine is as follows (in professional offshore linux machine — Red Hat on VMWare).

    1 399 39.9% ls
    2 187 18.7% cd
    3 59 5.9% java
    4 58 5.8% javac
    5 43 4.3% rm
    6 31 3.1% vi
    7 22 2.2% mv
    8 20 2% chmod
    9 17 1.7% jar
    10 17 1.7% cp

    Cheers!!!

  24. To run properly on Arch linux need a very small modification of the command

    history | awk ‘{CMD[$4]++;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

    1 121 16.759% git
    2 64 8.86427% ls
    3 63 8.72576% sudo
    4 47 6.5097% emacs
    5 46 6.37119% vim
    6 34 4.70914% cat
    7 30 4.15512% less
    8 27 3.73961% yu
    9 23 3.1856% echo
    10 22 3.04709% ys

  25. Thanks OP for the simple analysis/opportunity to share and compare!

    I ran it in my cygwin bash shell:

    1 80 16% cd
    2 62 12.4% ls
    3 62 12.4% ll
    4 48 9.6% cvs
    5 32 6.4% rm
    6 18 3.6% less
    7 17 3.4% ssh-add
    8 16 3.2% screen
    9 16 3.2% pskill
    10 15 3% cvsfwd

    I spend about half of my commandline time in a 4NT window, and I’ve got a huge cmd history saved up from that. I’m going to have to figure out an equivalent procedure to analyze the frequency of the commands I run in that shell. I’ll post here if I ever actually get around to it.

  26. reply 1

  27. newone reply 1

  28. Mine is here:
    1 114 22.8% vim
    2 74 14.8% gcc
    3 55 11% cd
    4 27 5.4% exit
    5 25 5% sudo
    6 17 3.4% chmod
    7 17 3.4% cat
    8 12 2.4% python
    9 10 2% ls
    10 10 2% g++

  29. rua vietnam

  30. Hey that looks awesome

  31. Hello, Hi, Hey, great article, post, blog, I, we love, like, loved, liked it !!!

  32. [...] I just saw this post on http://linux.byexamples.com/ [...]

  33. Great command. Lets see what we have at office box:
    1 190 18.8492% ls
    2 182 18.0556% sudo
    3 157 15.5754% cd
    4 64 6.34921% vim
    5 39 3.86905% ssh
    6 25 2.48016% rm
    7 16 1.5873% cat
    8 15 1.4881% yes
    9 13 1.28968% tmux
    10 13 1.28968% scp

  34. [...] might be a good idea to search your history for your most commonly used commands. A one-liner from here allows us to see our most used [...]

  35. This paragraph is actually a fastidious one it helps new net visitors, who
    are wishing for blogging.

  36. If you are going for finest contents like myself, simply visit this site daily as
    it offers quality contents, thanks

  37. Thwre is definately a great deal to find out about this issue.
    I love all of the points you have made.

Leave a Reply