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

猜你喜欢

转载自www.cnblogs.com/pythonal/p/10142409.html