Why is zsh no longer storing history?

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!

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#blogumentation #zsh.

This post was filed under articles.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.