记录 时间,用户,地址,历史命令
vim /etc/profile USER_IP=`who -u am i 2> /dev/null | awk ‘{print $NF}‘ | sed -e ‘s/[()]//g‘` PROMPT_COMMAND=‘date "+[ %Y%m%d-%H:%M:%S $LOGNAME from $USER_IP ]: `history 1 |cut -c 8-`" >> /var/log/command.log‘ source /etc/profile
本文出自 “不抛弃!不放弃” 博客,请务必保留此出处http://thedream.blog.51cto.com/6427769/1729280
原文:http://thedream.blog.51cto.com/6427769/1729280