history 命令配置

history命令常常用到,但当你打开多个终端操做命令的话,最后一个退出的bash历史记录,会覆盖以前的历史内容。html

博客Keeping Command History across Multiple Sessions 讨论了这个问题。解决办法以下:linux

Insert the 2 statements into ~/.bashrc
shopt -s histappend
PROMPT_COMMAND='history -a;history -n;$PROMPT_COMMAND'
相关文章
相关标签/搜索