Linux开启同步history记录到指定文件

[root@node1 tmp]# vi /etc/profile

export PROMPT_COMMAND='{ msg=$(history 1 | { read x y; echo $y; });echo  "[euid=$(whoami)]":$(who am i):[`pwd`]#"$msg" >>/tmp/history_cmd.log; }'

[root@node1 tmp]# .  /etc/profile

[root@node1 tmp]# chmod 777  history_cmd.log 

[root@node1 tmp]# chattr  +a  history_cmd.log 

猜你喜欢

转载自www.cnblogs.com/qqran/p/11668105.html
今日推荐