Is there a maximum size to the bash history file?

Instead of specifying numbers, you can do

unset HISTSIZE 
unset HISTFILESIZE
shopt -s histappend

in which case only your disk size (and your "largest file limit", if your OS or FS has one) is the limit.

However, be aware that this will eventually slow down bash more and more. see this BashFAQ document and the debian-administration article (original link died, look in a mirror: archive.is and archive.org) for techniques which scale better.


You can use logrotate to preserve old entries. It allows you, for example, to set size limits that will trigger archiving. It is normally run from a daily cronjob, but you might just as well invoke it from your .bash_logout script.


@Philomath, unsetting those environment vars does not work for me at all! For me, this causes bash to use its inbuilt defaults (it seems) of truncating .bash_history to about 9KiB.

What does work for me is the following in my .bashrc:

export HISTSIZE=
export HISTFILESIZE=
shopt -s histappend