如何打印出系统最近使用的1000条命令中最多的10条
发表于 : 2011-06-22 16:22
如题
我的想法是使用lastcomm命令,然后再使用排序找出前10条命令
但是不知道要怎么用lastcomm命令只打印使用过的命令而没有详细信息好存进一个文本文件中进行比较
我的想法是使用lastcomm命令,然后再使用排序找出前10条命令
但是不知道要怎么用lastcomm命令只打印使用过的命令而没有详细信息好存进一个文本文件中进行比较
。。。真牛。。。那个帖子大概叫什么名呀?nmsfan 写了:坛子有个神贴
昨天还顶过了
不知道在哪个区
就是贴你最常用的10个命令
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
代码: 全选
tlcr: 0 2011-06-23 16:38 tusooa-laptop ~
● which topx
topx () {
history 0 | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | GREP_COLOR="$(echo 3$[$(date +%N)%6+1]';1;4;40')" egrep --color=always -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n "$1"
}
tlcr: 0 2011-06-23 16:45 tusooa-laptop ~
●
记不得了,翻bash记录翻出来的piggyZhao 写了:。。。真牛。。。那个帖子大概叫什么名呀?nmsfan 写了:坛子有个神贴
昨天还顶过了
不知道在哪个区
就是贴你最常用的10个命令
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
代码: 全选
tail -1000 .bash_history |sort|uniq -c|sort -k1nr|head -10
电脑辛苦了;我也辛苦了。gzbao9999 写了:悄悄自己写了个话说那个history指令 有没有不显示行号的参数?代码: 全选
tail -1000 .bash_history |sort|uniq -c|sort -k1nr|head -10
代码: 全选
mianzhi@mianzhi-laptop:~$ tail -1000 .bash_history |sort|uniq -c|sort -k1nr|head -10
127 make
98 ./teflon3dFVM
76 exit
45 make clean
42 ls
23 top
22 heat3dFVM
17 ./teflon
16 g++ test.cpp
14 ./a.out