August 1, 2017

November 25, 2019

Bash - increase command history size

Do you use CTRL+R shortcut in bash to search for previously used commands? I do and sometimes I can't find command because it was removed from history. Default history size is set to 1000 lines, at least on Fedora 26. It's not a small size but it's not enough for me. We can check the current settings.

$ echo $HISTSIZE
1000
$ echo $HISTFILESIZE
1000

What does it mean? Let's check man bash.

HISTSIZE

HISTFILESIZE

To change those limits, edit ~/.bashrc file and add:

HISTSIZE=20000
HISTFILESIZE=20000

Apply changes.

$ source ~/.bashrc

Done. You can set another limit, I would like to test 20000 ;-)

© 2020 Przemysław Kołodziejczyk