返回到文章

采纳

编辑于

linux history命令显示时间

Linux
笔记

临时设置

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

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

永久设置

也可直接写到/etc/profile永久生效。

echo 'HISTTIMEFORMAT="%F %T "' >> /etc/profile

然后执行source .bash_profile即可。