0

I've reached the maximum 10K lines of commands in my zsh history file, but I want to store more commands.

So I set this, in my ~/.zshrc file:

export HISTFILE="$HOME/.zsh_history"
export HISTSIZE=1000000000
export SAVEHIST=1000000000
setopt EXTENDED_HISTORY

And I made sure to run source ~/.zshrc after editing this file.

But when I echo these variables, I get different results:

zsh history is limited

And when I close the terminal and open a new session, I can see that the number of commands in my history file is 10K:

Number of commands in zsh history is 10K again

How can I fix it so that I can store more than 10K commands in my ~/.zsh_history file?

Also, when I run wc -l < $HISTFILE, it gives me a number more than 10K:

enter image description here

What's going on?

2

I assume that this is not your entire .zshrc and that the variables are set somewhere else.

Make sure you're not using any other script that overwrites these variables, such as oh-my-zsh (example), and that you place your commands at the bottom of your config file.

  • I was using oh-my-zsh and placing the exports at the bottom fixed it. Thank you. – Amir A. Shabani Jan 14 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.