Linux open sync history records to the specified file

[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 

Guess you like

Origin www.cnblogs.com/qqran/p/11668105.html