Re: Problems with history

Bart Schaefer <[email protected]> Mon, 15 Dec 2025 12:37:37 -0800
Newsgroups gmane.comp.shells.zsh.user
Message-ID <CAH+w=7ZZNwOQb1+CeFnGbo2JSeLw-3P=JRFBVT=MzBc1H2LLUA@mail.gmail.com>
On Mon, Dec 15, 2025 at 8:18 AM Perry Smith <[email protected]> wrote:

>
> /bin/zsh —version reports zsh 5.9 (arm64-apple-darwin25.0)
> /opt/homebrew/bin/zsh —version reports zsh 5.9 (arm-apple-darwin22.1.0)
> I’m assuming Terminal uses /bin/zsh
>

You could `print $ZSH_PATCHLEVEL` from the PS1 prompt to confirm


> When is the history file read in?
>

Pretty much the last thing before the prompt is printed, definitely after
all the startup files are read UNLESS one of those files contains an "fc"
or "history" command.


> Does setting HISTSIZE or SAVEHIST cause the current history list to get
> truncated?
>

HISTSIZE truncates the shell's internal history list, yes.  SAVEHIST won't
kick in until the history is written back to HISTFILE.


> Is there any other things I should check?
>

As an addenda to Mark Reed's comments, you could try printing the values of
the history variables in your .zlogout file (follow that with a `sleep` so
you have a chance to see the output).