Configs Shell history

Bash and zsh history settings, explained

Bigger, shared zsh history

The default history is insultingly small and forgets things when you close a terminal. This makes it big, saves every command the moment you run it, and shares history across open terminals. hist_ignore_dups keeps consecutive repeat commands (yes, yes, up-arrow, up-arrow) from flooding it.

zsh · ~/.zshrc
HISTSIZE=100000
SAVEHIST=100000
HISTFILE=~/.zsh_history
setopt share_history
setopt hist_ignore_dups

WHERE: ~/.zshrc — reload with source ~/.zshrc.

Bigger, appending bash history

Same idea, bash edition. Without histappend, every new terminal truncates history instead of appending to it, which is how your commands evaporate. HISTCONTROL=ignoreboth skips duplicates and commands starting with a space — handy for keeping secrets out of the log.

bash · ~/.bashrc
HISTSIZE=100000
HISTFILESIZE=200000
HISTCONTROL=ignoreboth
shopt -s histappend

WHERE: ~/.bashrc — reload with source ~/.bashrc.