Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Share your top 10 linux commands
7 points by giis on July 24, 2013 | hide | past | favorite | 20 comments
Today I came across interesting post which displays top 10 commands from history file.

$ 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

Here is my results:

     1	135  13.5%  vim

     2	133  13.3%  gcc

     3	122  12.2%  ls

     4	52   5.2%   cd

     5	47   4.7%   less

     6	43   4.3%   grep

     7	38   3.8%   exit

     8	35   3.5%   cat

     9	29   2.9%   python

    10	25   2.5%   sudo


     1	237  23.7%  ls
     2	119  11.9%  cd
     3	91   9.1%   vim
     4	68   6.8%   screen
     5	45   4.5%   exit
     6	40   4%     more
     7	40   4%     grep
     8	31   3.1%   top
     9	25   2.5%   ps
    10	18   1.8%   df
Seems weird that these would be my most used commands. Although screen contains stuff which is not the history outside screen. And I spend by far the most time in screen. So let's see what the screens have:

cross compiling for ARM screen:

     1  160  26.9815%   ls
     2  102  17.2007%   make
     3  79   13.3221%   cd
     4  51   8.60034%   find
     5  47   7.9258%    vim
     6  39   6.57673%   more
     7  10   1.68634%   git
     8  9    1.51771%   grep
     9  4    0.674536%  tar
    10  4    0.674536%  rm
web dev screen:

     1	46  20.8145%   vim
     2	31  14.0271%   ls
     3	21  9.50226%   git
     4	20  9.04977%   supervisor
     5	12  5.42986%   more
     6	6   2.71493%   ssh
     7	6   2.71493%   cd
     8	5   2.26244%   nano
     9	4   1.80995%   ps
    10	3   1.35747%   sudo
Haskell dev screen (painful day today fighting with cabal):

     1	80  16%    cabal
     2	64  12.8%  nano
     3	63  12.6%  ls
     4	22  4.4%   more
     5	21  4.2%   cd
     6	21  4.2%   apt-get
     7	20  4%     supervisor
     8	18  3.6%   git
     9	15  3%     ghc
    10	12  2.4%   find


Looks like you use nano for Haskell development and vim for the other stuff why's that? And a minor tip, you can close your tty using ^D (because I saw exit).


Well in the particular case I wasn't coding Haskell; I was fighting cabal :) I needed to install some GUI lib and that took it's sweet time. But there was no coding involved just messing around with build files and such. Not sure why I didn't use vim for that, I use it for coding anyway.


On my MacBook:

     1	110  22%    ls
     2	99   19.8%  cd
     3	44   8.8%   top
     4	39   7.8%   vi
     5	23   4.6%   pwd
     6	23   4.6%   crashoff
     7	16   3.2%   rm
     8	14   2.8%   du
     9	12   2.4%   crashon
    10	11   2.2%   ssh
(crashon / crashoff are scripts to start and stop CrashPlan)

Raspberry Pi:

     1	85  26.3158%   ls
     2	53  16.4087%   sudo
     3	20  6.19195%   pwd
     4	20  6.19195%   cd
     5	19  5.88235%   exit
     6	17  5.26316%   crontab
     7	12  3.71517%   df
     8	11  3.40557%   streamripper
     9	10  3.09598%   ps
    10	9   2.78638%   date
(was setting up a streamripper cronjob recently, so it's skewed)


     1	116  39.4558%   sudo
     2	37   12.585%    cd
     3	29   9.86395%   ls
     4	5    1.70068%   traceroute
     5	5    1.70068%   nautilus
     6	5    1.70068%   ifconfig
     7	5    1.70068%   chmod
     8	4    1.36054%   ssh
     9	3    1.02041%   x64
    10	3    1.02041%   ping
Nothing too exciting, use Ubuntu desktop mostly, most of the sudo stuff is likely apt-get and other non-repository installation stuff. Network debugging, Nautilus was when I was trying out desktop managers managers... Glad to see VICE C64 emulator on the list.


My results vary pretty dramatically depending on which of my history files I point it at, as expected (I separate them by context).

It seems like this'll be warped by a couple things, though. It only sees the first command in a pipeline (I don't see a good general solution to this...) and loops just see the loop, blocks just see the { or (, etc. It's also going to be missing hidden lines (HISTCONTROL=ignoredups, etc).

Interesting, nonetheless.


On my work computer (I'm a webdev):

     1	101  20.2%  vim
     2	64   12.8%  gs
     3	56   11.2%  cd
     4	49   9.8%   git
     5	40   8%     ls
     6	30   6%     ga
     7	20   4%     grep
     8	20   4%     gcm
     9	20   4%     brake
    10	14   2.8%   gpso
`git` actually is a much higher percentage, since `gs`, `ga`, `gcm`, and `gpso` are aliases for various git commands.


     1	1743  35.0493%    git
     2	726   14.5988%    ls
     3	385   7.74181%    cd
     4	314   6.3141%     rvm
     5	307   6.17334%    vim
     6	197   3.96139%    rake
     7	98    1.97064%    tmux
     8	97    1.95053%    ..
     9	86    1.72934%    ag
    10	72    1.44782%    rspec
Not too surprising. I'm surprised how high rvm is on the list.


     1	182  18.2%  git
     2	151  15.1%  ls
     3	125  12.5%  cd
     4	51   5.1%   rake
     5	46   4.6%   cat
     6	43   4.3%   vi
     7	36   3.6%   tail
     8	33   3.3%   casperjs
     9	32   3.2%   rails
    10	29   2.9%   tubesio
Lol, I use cat more than vim (not really, I just have one vim session open and navigate files with :e)


At work:

     1	121     24.2%  ls
     2	83      16.6%  svn
     3	40      8%     cd
     4	38      7.6%   cat
     5	31      6.2%   sudo
     6	21      4.2%   scp
     7	20      4%     zip
     8	18      3.6%   mysql
     9	15      3%     xrandr
    10	14      2.8%   ssh


Mostly sysadmin stuff, because that's what I do.

     1  177  19.2601%   ls
     2  113  12.296%    vim
     3  101  10.9902%   cd
     4  95   10.3373%   ssh
     7  25   2.72035%   rm
     8  18   1.95865%   grep
    10  13   1.41458%   df


     1  104  10.4%  valac
     2  98   9.8%   cd
     3  84   8.4%   fg
     4  83   8.3%   emacs
     5  59   5.9%   ls
     6  47   4.7%   ssh
     7  32   3.2%   vala
     8  31   3.1%   cat
     9  22   2.2%   mkdir
    10  22   2.2%   ..


On dev box :

     1	213  21.3%  vi
     2	172  17.2%  git
     3	161  16.1%  ls
     4	135  13.5%  cd
     5	37   3.7%   python
     6	36   3.6%   screen
     7	32   3.2%   rm
     8	21   2.1%   wget
     9	18   1.8%   mv
    10	15   1.5%   cat


On desktop :

     1	124  12.4%  ls
     2	115  11.5%  ssh
     3	96   9.6%   cd
     4	91   9.1%   git
     5	89   8.9%   vi
     6	72   7.2%   sudo
     7	36   3.6%   rm
     8	24   2.4%   vagrant
     9	18   1.8%   adb
    10	17   1.7%   cat


     1	83  16.6%  django-admin.py
     2	73  14.6%  git
     3	56  11.2%  fab
     4	42  8.4%   ls
     5	40  8%     cd
     6	39  7.8%   ssh
     7	24  4.8%   knife
     8	16  3.2%   python
     9	14  2.8%   pip
    10	13  2.6%   ping


On my macbook:

   1	90  18%    cd
     2	86  17.2%  rails
     3	64  12.8%  ls
     4	44  8.8%   ssh
     5	37  7.4%   rake
     6	34  6.8%   ping
     7	24  4.8%   git
     8	21  4.2%   dig
     9	11  2.2%   cat
    10	9   1.8%   whois


     1	107  21.4%  php
     2	96   19.2%  ls
     3	72   14.4%  cd
     4	42   8.4%   ssh
     5	33   6.6%   sudo
     6	29   5.8%   composer
     7	14   2.8%   rm
     8	12   2.4%   exit
     9	10   2%     git
    10	6    1.2%   nano


     1	162  32.4%  ls
     2	71   14.2%  cd
     3	31   6.2%   git
     4	30   6%     sudo
     5	19   3.8%   rm
     6	19   3.8%   find
     7	17   3.4%   mv
     8	9    1.8%   more
     9	9    1.8%   go
    10	9    1.8%   dmesg


     1	331  33.1%  git
     2	170  17%    cd
     3	76   7.6%   exit
     4	71   7.1%   ll
     5	53   5.3%   make
     6	49   4.9%   ls
     7	41   4.1%   fab
     8	32   3.2%   find
     9	30   3%     sudo
    10	16   1.6%   rm


interesting to see 'git' commonly used more like regular bash commands :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: