If you want to maintain your command history in your shell when using ZSH or Bash do the following:
-
Using your favourite text editor, open
.zshrcif you are using Z shell or.bashrcif you are using Bash shell in your home directory. -
Add the following to the config file of the shell:
# Large in-session history (up-arrow navigation within the tab)
HISTSIZE=10000
# Prevent writing history to disk entirely
SAVEHIST=0
HISTFILE=/dev/null
# (Optional) Ensure history is NOT shared between tabs or appended across sessions
unsetopt SHARE_HISTORY
unsetopt INC_APPEND_HISTORY
unsetopt APPEND_HISTORY
-
Save the file.
-
Reload the config file for the shell by typing
source ~/.zshrcorsource ~/.bashrcdepending on the shell that you are using. -
Your new settings should have taken effect.