linux history记录格式修改

#保存一万条命令记录
sed -i 's/^HISTSIZE=1000/HISTSIZE=10000/g' /etc/profile

#在/etc/profile的文件尾部添加如下行数配置信息
######jiagu history xianshi#########
USER_IP=`who -u am i 2>/dev/null | awk '{print $NF}' | sed -e 's/[()]//g'`
if [ "$USER_IP" = "" ]
then
USER_IP=`hostname`
fi
export HISTTIMEFORMAT="%F %T $USER_IP `whoami` "
shopt -s histappend
export PROMPT_COMMAND="history -a"
######### jiagu history xianshi ##########
source /etc/profile

 

posted @ 2018-12-19 12:02  BigZero  阅读(2009)  评论(0编辑  收藏  举报