临时生效:
[root@localhost ~]# HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S"
[root@localhost ~]# export HISTTIMEFORMAT
[root@localhost ~]# history
永久生效
[root@localhost ~]# cat ~/.bashrc
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S"
[root@localhost ~]#
[root@localhost ~]# source ~/.bashrc
[root@localhost ~]# history