linux history命令显示时间

在CentOS上使用history查看历史使用的CMD记录时,发现没有时间,在当前用户的.bash_profile里面,添加

    export HISTTIMEFORMAT="%F %T  `whoami`"

然后执行source .bash_profile即可。

但使用zsh时这样不好用,查询到oh-my-zsh 使用

    history -i 即可显示出时间。

原文地址:https://www.cnblogs.com/b-ruce/p/6242153.html