1. cat <<EOF >>~/.bashrc
  2. # Avoid duplicates
  3. export HISTCONTROL=ignoredups:erasedups
  4. # When the shell exits, append to the history file instead of overwriting it
  5. shopt -s histappend
  6. # After each command, append to the history file and reread it
  7. export PROMPT_COMMAND="\${PROMPT_COMMAND:+\$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
  8. EOF

Heredocument to share hisroty of each shell with others sessions shells around..

Works with 1 last command of delay

you can type one only to 'commit'

ie command: aaaa