1. 程式人生 > >linux history命令優化

linux history命令優化

etc span 增加 profile orm /dev/ mat hist 記錄

主要功能:
1, 可以記錄哪個ip和時間(精確到秒)以及哪個用戶,作了哪些命令
2,最大日誌記錄增加到4096條
 
把下面的代碼直接粘貼到/etc/profile後面就可以了
#history modify
export HISTTIMEFORMAT="[%Y.%m.%d %H:%M:%S-$USER_IP-$USER]"
USER_IP=`who -u am i &>/dev/null| awk {print $NF}|sed -e s/[()]//g`
if [ -z $USER_IP  ]
then
  USER_IP="NO_client_IP"
fi
export HISTSIZE
=4096

linux history命令優化