v2ex看到一条统计最常用命令的脚本,收藏一下~

$ 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
     1	167  33.4%  vim
     2	104  20.8%  ls
     3	75   15%    make
     4	25   5%     cd
     5	13   2.6%   sshgo
     6	11   2.2%   telnet
     7	11   2.2%   sudo
     8	10   2%     find
     9	5    1%     mv
    10	4    0.8%   ps

from:http://v2ex.com/t/98373