Skip to main content

Preserving Linux Shell History Even If Working with Multiple Terminals

If you are continuously running shell commands on more than one linux terminal, probably you want all of the shell (mostly bash) prompts to remember any command from any terminal. With the following environmental variables to save the .bashrc file, you can do it so.

# This is for ignoring duplicate entries
export HISTCONTROL=ignoredups:erasedups

# This is for large history
export HISTSIZE=102400

# This is for a big history file
export HISTFILESIZE=100000

# This is for appending commands to history file
shopt -s histappend

# This is for saving and reloading the history after each command is run
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"


Popular posts from this blog