vim env.sh
export HISTTIMEFORMAT="%F %T "

 centos系统下history如何看到执行命令的时间 - 树在地上 -

echo 'export HISTTIMEFORMAT="%F %T "' >/etc/profile.d/env.sh 

 source /etc/profile

linux centos7清除系统日志、历史记录、登录信息_勿忘初心,砥砺前行的技术博客_51CTO博客

用一个例子来演示会更加清晰