Couter计数器参考链接
history保存在~/.bash_history中
import os
from collections import Couter
c = Couter()
witn open("~/.bash_hisstorry") as f:
for line in f:
cmd = line.strip().split()#先去除两边空格,在再分片
if cmd:
c[cmd[0]] +=1
c.most_common(10)#输出数量最多的10个
Bash历史命令分析

7万+

被折叠的 条评论
为什么被折叠?



