设置方法:

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

#echo 'export HISTTIMEFORMAT="`whoami` | %F %T | "' >> /etc/profile

#. /etc/profile


效果如下:

# history

 ......

 1047  root | 2015-08-14 17:38:54 | ulimit -a

 1048  root | 2015-08-14 17:45:09 | cd

 1049  root | 2015-08-14 17:45:11 | history 

 1050  root | 2015-08-14 17:45:41 | ansible Player -m ping

 1051  root | 2015-08-14 17:48:59 | ansible Player -m shell -a "ifconfig eth0"

 1052  root | 2015-08-14 17:49:25 | ansible Player -a "ntpdate ntp.api.bz"

 1053  root | 2015-08-14 17:49:39 | history