Tag Archives: history

What’s in my history?

在 一宁的 blog 上看到这么好玩的命令: $history|awk ‘{a[$2]++} END{for(i in a){printf "%5d\t%s\n",a[i],i}}’|sort -rn|head 82 ls 64 cd 44 sudo 42 vim 37 svn 25 lftp 22 ./test.sh 17 memcached-tool.pl 11 ping 11 gvim 下面是改进版,可以加入百分比统计: $history | awk ‘{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}’ | grep -v "./" | column -c3 [...]

content