Chinaunix首页 | 论坛 | 博客
  • 博客访问: 320986
  • 博文数量: 15
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 179
  • 用 户 组: 普通用户
  • 注册时间: 2013-09-09 18:16
文章分类

全部博文(15)

文章存档

2019年(1)

2018年(1)

2015年(7)

2013年(6)

我的朋友

分类: LINUX

2015-01-21 16:36:14


将以下内容追加到/etc/profile后面

history
USER=`whoami`
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/history ]; then
 mkdir /tmp/history
 chmod 777 /tmp/history
fi
if [ ! -d /tmp/history/${LOGNAME} ]; then
 mkdir /tmp/history/${LOGNAME}
 chmod 300 /tmp/history/${LOGNAME}
fi
export HISTSIZE=4096
DT=`date +"%Y-%m-%d_%H:%M:%S"`
export HISTFILE="/tmp/history/${LOGNAME}/${USER}@${USER_IP}_history.$DT"
chmod 600 /tmp/history/${LOGNAME}/*history* 2>/dev/null
阅读(1090) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~