讓 Linux 用戶所下過的指令立刻回寫回記錄

Linux 中預設只有在用戶登出時才會將 history 回寫回記錄,如果要將用戶所下過的每一行指令都留下來就要改 PROMPT讓每一行指令都立刻回寫回記錄中,

可以將下列這行加到 /etc/bashrc 中

export PROMPT_COMMAND=’history -a; history -c; history -r’

Author: jerryw1974

learning and focus on computer science, cloud infrastructure, virtualization and information security, technical, networking,platform system and cyber-security related topic.