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个