vim /etc/profile 末尾添加,然后保存
PS1="`whoami`@`hostname`:"'[$PWD]'
history
USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`
if [ "$USER_IP" = "" ]
then
USER_IP=`hostname`
fi
if [ ! -d /tmp/cmuse ]
then
mkdir /tmp/cmuse
chmod 777 /tmp/cmuse
fi
if [ ! -d /tmp/cmuse/${LOGNAME} ]
then
mkdir /tmp/cmuse/${LOGNAME}
chmod 300 /tmp/cmuse/${LOGNAME}
fi
export HISTSIZE=4096
DT=`date "+%Y-%m-%d_%H:%M:%S"`
export HISTFILE="/tmp/cmuse/${LOGNAME}/${USER_IP}_cmuse.$DT"
chmod 600 /tmp/cmuse/${LOGNAME}/*cmuse* 2>/dev/null
source /etc/profile
转载于:https://blog.51cto.com/lynn1105/1597392