来晒晒你使用过的 Linux 命令的 top 10 吧!

2014-04-18 23:50:14 +08:00
 yxjxx
刚刚在 http://talk.linuxtoy.org/using-cli/ 看到了一条命令可以显示你使用过的命令的top10.
而且网页使用的类似的ppt效果也超级赞呢!


命令是:
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
19895 次点击
所在节点    Linux
176 条回复
yxjxx
2014-04-19 12:57:14 +08:00
@LazyZhu 原来真有人发过类似的帖子啊.话说680天前我还没有加入v2ex呢! 看到那贴也是有250+的回复,大家对类似帖子热情还是蛮高的嘛!
a591826944
2014-04-19 13:01:09 +08:00
1 598 23.8627% cd
2 522 20.83% ls
3 190 7.5818% vim
4 136 5.42698% hg
5 103 4.11014% sudo
6 81 3.23224% php
7 79 3.15243% ps
8 78 3.11253% la
9 57 2.27454% clear
10 53 2.11492% rm
toctan
2014-04-19 13:03:18 +08:00
oh-my-zsh 内置这条命令,直接 zsh_stats 就 OK 啦。

$ zsh_stats
yhf
2014-04-19 13:13:30 +08:00
1 166 33.1337% git
2 100 19.9601% python
3 69 13.7725% ls
4 63 12.5749% cd
5 25 4.99002% sublime
6 11 2.19561% sudo
7 7 1.39721% mysql
8 5 0.998004% rm
9 5 0.998004% pip
10 4 0.798403% mongo
cevincheung
2014-04-19 13:15:07 +08:00
1 136 27.1457% ls
2 74 14.7705% cd
3 70 13.9721% exit
4 35 6.98603% nano
5 29 5.78842% rz
6 20 3.99202% rm
7 19 3.79242% cat
8 16 3.19361% wget
9 15 2.99401% php
10 9 1.79641% mv
Lelouchcr
2014-04-19 13:21:43 +08:00
1 248 49.501% du
2 128 25.5489% ls
3 27 5.38922% git
4 24 4.79042% cd
5 18 3.59281% rm
6 15 2.99401% ps
7 13 2.59481% mvn
8 6 1.1976% ffmpeg
9 4 0.798403% vim
10 4 0.798403% scp

这么多du,我自己都惊讶了。。
wazedix
2014-04-19 13:44:09 +08:00
1 1950 19.502% vi
2 1673 16.7317% hg
3 1410 14.1014% git
4 1052 10.5211% ls
5 610 6.10061% cd
6 391 3.91039% python
7 322 3.22032% j
8 257 2.57026% ack
9 191 1.91019% rm
10 144 1.44014% svn

比较奇葩得三个版本控制器都进了前10
cpp255
2014-04-19 14:04:43 +08:00
1 105 20.9581% ls
2 89 17.7645% git
3 78 15.5689% cd
4 51 10.1796% cc
5 22 4.39122% node
6 17 3.39321% gradle
7 15 2.99401% vi
8 10 1.99601% sudo
9 10 1.99601% find
10 7 1.39721% rm
新机器
Jeremial
2014-04-19 14:06:03 +08:00
1 5247 52.4752% git
2 714 7.14071% cd
3 362 3.62036% npm
4 277 2.77028% st
5 263 2.63026% sudo
6 253 2.53025% rm
7 242 2.42024% j
8 204 2.0402% node
9 141 1.41014% make
10 130 1.30013% l
kqz901002
2014-04-19 14:06:51 +08:00
1 978 16.1493% cd
2 972 16.0502% ls
3 717 11.8395% ping
4 452 7.46367% brew
5 287 4.7391% sudo
6 198 3.26948% ssh
7 184 3.03831% vim
8 177 2.92272% nslookup
9 135 2.22919% rm
10 120 1.98151% dig
HackerOO7
2014-04-19 14:09:37 +08:00
1 387 38.6613% git
2 176 17.5824% cd
3 133 13.2867% adb
4 65 6.49351% gitk
5 46 4.5954% croot
6 43 4.2957% make
7 27 2.6973% repo
8 27 2.6973% grep
9 24 2.3976% subl
10 22 2.1978% ls
javaluo
2014-04-19 14:13:24 +08:00
1 107 18.2906% w
2 37 6.32479% sh
3 35 5.98291% cat
4 23 3.93162% wget
5 23 3.93162% ping
6 22 3.76068% lsof
7 20 3.4188% ssh
8 19 3.24786% cd
9 18 3.07692% ls
10 12 2.05128% service
sitin
2014-04-19 14:16:18 +08:00
1 1718 27.1449% ls
2 1214 19.1815% cd
3 655 10.3492% python
4 416 6.57292% vi
5 403 6.36751% git
6 87 1.37462% ssh
7 82 1.29562% pip
8 80 1.26402% sudo
9 79 1.24822% source
10 75 1.18502% mv

这个啥,没想到我还比较纠结重命名。。
flynngao
2014-04-19 14:17:41 +08:00
1143 2.61235% grunt
2 56 1.02302% python
3 55 1.00475% sudo
4 51 0.931677% jekyll
5 27 0.493241% ping
6 27 0.493241% mongo
7 15 0.274023% pwd
8 6 0.109609% java
9 1 0.0182682% glup
10 1 0.0182682%
mingzhi
2014-04-19 14:45:18 +08:00
1 567 16.5741% cd
2 540 15.7849% ls
3 519 15.171% git
4 490 14.3233% make
5 139 4.06314% vim
6 134 3.91698% la
7 57 1.66618% cabal
8 51 1.49079% ping
9 41 1.19848% open
10 33 0.96463% ghci
ericFork
2014-04-19 14:48:13 +08:00
1 781 7.81078% whois
2 779 7.79078% curl
3 682 6.82068% ping
4 639 6.39064% vim
5 571 5.71057% cd
6 490 4.90049% git
7 464 4.64046% gca
8 377 3.77038% mtr
9 372 3.72037% s
10 314 3.14031% clear

这个 whois 高得有点诡异
realfun
2014-04-19 15:06:21 +08:00
写了个脚本总结了一下目前为止列出来的东东,上top10榜次数最多的是:

('ls', 13)
('cd', 13)
('vim', 11)
('rm', 8)
('git', 6)
('mv', 5)
('sudo', 5)
('wget', 4)
('screen', 4)
('python', 4)
dorentus
2014-04-19 15:12:18 +08:00
我想起来我那个列表看起来不科学的原因了……
我的 .bashrc 里面有这么一条:

# http://askubuntu.com/questions/15926/how-to-avoid-duplicate-entries-in-bash-history
HISTCONTROL=ignoreboth:erasedups

重复的命令不会记录
xujingbao
2014-04-19 15:40:32 +08:00
1 1106 17.4009% ls
2 832 13.09% cd
3 539 8.48018% git
4 525 8.25991% brew
5 459 7.22152% rake
6 342 5.38074% ll
7 251 3.94902% vi
8 242 3.80743% j
9 116 1.82505% sudo
10 110 1.73065% tmux
skydiver
2014-04-19 15:43:38 +08:00
1 163 17.086% sudo
2 140 14.6751% pacman
3 94 9.85325% cd
4 54 5.66038% git
5 49 5.13627% cat
6 48 5.03145% vim
7 26 2.72537% rm
8 15 1.57233% echo
9 14 1.46751% mv
10 13 1.36268% yaourt

zsh 里得把 history 改成 history 1 才行

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/109153

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX