How to enable history sharing between terminals in GNU screen
It annoys me for a long time that I can't save/load command history from other terminals when I am in screen, history within every single tab is erased when my session is killed, and even worse, I can't use other commands from other opened terminals. One of my colleague shares a tip with me which partially solve this issue.
You can either wrap the following in your ~/.bashrc or export every line.
# Ignore space and do not allow duplicates HISTCONTROL=ignorespace:erasedups # Increase history size HISTSIZE=1000 HISTFILESIZE=2000 # This does the magic! It changes the default behavior from overwrite history # to append into the file. Clear and reload the buffer every time it is finished. export PROMPT_COMMAND='history -a; history -c; history -r'
The reason I said it partially work is because I will have to clear the screen if I want to load history.