操作
编辑文件
gedit /etc/profile
编辑内容
# Add additional information to the "history" command: execution time + executorUSER_IP=`who -u am i 2>/dev/null | awk '{print $NF}' | sed -e 's/[()]//g'`HISTDIR=/var/log/historyif [ -z $USER_IP ]thenUSER_IP=`hostname`fiexport HISTSIZE=4096DT=`date +%Y%m%d_%H%M%S`export HISTFILE="$HISTDIR / ${LOGNAME}_${USER_IP} $DT"export HISTTIMEFORMAT="%F %T | $USER_IP:`whoami` | "chmod 666 $HISTDIR /* 2>/dev/null
执行
source /etc/profile
查看效果
history
