添加环境变量HISTTIMEFORMAT就行了
# export HISTTIMEFORMAT='%F %T '
其中:
%F full date; same as %Y-%m-%d %T time; same as %H:%M:%S
%F full date; same as %Y-%m-%d
%T time; same as %H:%M:%S
如果不想每次都输入,就放到~/.bashrc 、/etc/profile 或者/etc/bashrc中吧
效果如图: