Extending bash history limits

I use bash on a daily basis. From time to time I want to refer to a command that I executed in the past. Very often I start scrolling and terminal ends. As a result, I am not able to find the command 🤷

Thanks to When laziness is efficient: Make the most of your command line TIL that there are two environment variables that can help to avoid such situations: HISTSIZE and HISTFILESIZE.

I set both of them inside .zshrc file to `10000000`:

# Longer bash history
export HISTFILESIZE=10000000
export HISTSIZE=10000000

Thanks to that I will be able to grep the history deeper 🙂

Bonus: The article reminded me that in addition to CTRL+R there is also the history command that displays all the bash commands executed in the past.

 

Igor Springer

I build web apps. From time to time I put my thoughts on paper. I hope that some of them will be valuable for you. To teach is to learn twice.

 

Leave a Reply

Your email address will not be published. Required fields are marked *