有没有办法找出历史上最常用的十大命令?在这里,前10是指我大部分时间使用的命令,即其使用计数比其他命令多的命令。
发布于 2015-10-15 10:59:35
一行:
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 211 21.1% ls
2 189 18.9% sudo
3 58 5.8% man
4 52 5.2% cd
5 43 4.3% ping
6 40 4% apropos
7 34 3.4% less
8 22 2.2% cat
9 18 1.8% which
10 18 1.8% aspell这站点提供了更多的信息。
https://askubuntu.com/questions/685796
复制相似问题