【步骤】
1、/etc/profile文件中加入以下内容
2、执行:source /etc/profile
【效果】
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoUAAAAyCAIAAAClGzZnAAAMz0lEQVR4nO1d2ZXbMAzcalyNunE1qsbVbB3Jx9oSDwwu07o88/KRNSUAJEEOCR76+TkQpvn393G/7W2Gidv98btinsBj06wkfgqKbZ7inebfc9QBQRAEMQLTvFBG0fmfiY9NO10PfRK3++NL+Lgeg5zNeoIgiM9DJoDb/VFM3G73x/LIlfh4g8mxUVwpPh5vxga43e9LPk85oCAIgvgwpJ565al1VvN6Zv+e3QebjzeZHJOPJdzuj0PZQxAEEcSzV+1J8qeOBzY9HUgq4tH1YuY0Px9b/lNMkDsb6gmmz4x5WkRbFiq6XlkQO3aTbfvJ8UbF274r8bGY5UpiI6kOBxephhk4X2Jp1HGT5lFY1B3IxwRBnByvvnWZu5YkufRvfz3oq9NUkpb0umdc5E7z69FW1fJK3bFquqZ5/esvyTZe0NUzaJKP6wHBhsXbWdk9r2ZZ/FV+zjRDNR6UhugvwbA/6ZggiLOj5LT297J7K3pIJUl+d6XhlZBKbmufL/5WdLVqC4mG8Q1DuHtxnY87HhTUSVmULAwWr26HJ8s9AZolIz6gG49KQ6lKH+L8TRAEcTSAblfun3/nSU2CMl8zx4WPq+mMxMcLf0NdUtdfCPe9NY6Phckxlj+4eDvZGrM6+XgNOwOek+QYxmPLq5TgnjhOjQmCuAS2IYyFI/4myrf74zHP7fqxIO80fIySTszHZYoUwR/Kx8WbwcnxwbaVEQRBZIG6s8EB1YUklnXeVz8/T+3zpTx/5NkZ5f4MH8MZ3UbF21o5kI/hS8l4tRZg+H3cb6HJMePUBEFcB7CLrKKA9cYcJWn9Sdr2W60R3pptw9V2pvKcsseMJ7tXD8L9XCo5JfZzKTO6zYq3Tn6fj8uzvfLCr7IxTNvPpS/Aw7KHL3BuTBDERaB1kfEDOVLyml792sxs52k9RaOcuxHmaK/fG1ZUjgwN5mNxIxeU78pXqniROUk+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FWNTz37Iz/Mx4/easEIwXzsUZ7AQ3ByjMqQIIIYFPYmLorU7HNTHN/CqyLCx6cBl4KJHVGP7y7XuogUTK/Y3W2Ob+FVcemCjU2OCYIgCIIYCutgFUEQBEEQBHEenGXJwxnpGnOwOghs2z/8jyAIgvhSFFs5rc2KB4Rri83u+3DaXSrkY4IgiAPjP/9uyxzNwk2yAAAAAElFTkSuQmCC" alt="" />
export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S "
echo 'export HISTTIMEFORMAT="%F %T `whoami` "'
USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`
export HISTTIMEFORMAT="[%F %T][`whoami`][${USER_IP}] " USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`
export HISTTIMEFORMAT="[%F %T][`whoami`][${USER_IP}] "
#history
LOGIP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`
LOG_DIR=/var/log/history
if [ -z $LOGIP ]
then
LOGIP=`hostname`
fi
if [ ! -d $LOG_DIR ]
then
mkdir -p $LOG_DIR
chmod 777 $LOG_DIR
fi
if [ ! -d $LOG_DIR/${LOGNAME} ]
then
mkdir -p $LOG_DIR/${LOGNAME}
chmod 777 $LOG_DIR/${LOGNAME}
fi
export HISTSIZE=4096
LOGTM=`date +"%Y%m%d_%H%M%S"`
export HISTFILE="$LOG_DIR/${LOGNAME}/${LOGIP}-$LOGTM"
chmod 777 $LOG_DIR/${LOGNAME}/*-* 2>/dev/null