Why is zsh no longer storing history?
This post's featured URL for sharing metadata is https://www.jvt.me/img/profile.jpg.
On my first day back in the office, I noticed something odd with my zsh
setup, where new terminal sessions weren't having their history saved π€
Interestingly, my dotfiles specify the HISTSIZE
variable to a reasonably high amount, but it seems to not be working:
export HISTSIZE=30000
I've also since reproduced it on my other machines, so I think there's been a recent behaviour change to zsh
behaviour recently, rather than somehow simultaneously hitting 30000 history items on all my machines.
It turns out that via you should specify both HISTSIZE
and SAVEHIST
:
export HISTSIZE=30000
export SAVEHIST=30000
With these set, then zsh
will correctly save everything.
I'm unsure why it's worked for several years, but at least I've fixed it now!