I set export HISTSIZE=99999999999999 but is that the best way? I don't know if an overflow might occur. I'm looking for a tested, reliable way to remove command history limits.

  • there is no build-in mechanism to do that that I know of. – byrondrossos Apr 29 '12 at 17:06
  • I'm only commenting so that when this gets answered, I will know too!! – Adam Miller Apr 29 '12 at 17:07
  • 2
    debian-administration.org/articles/543 may be a better answer. At least, it handles larger values of infinity than the solution on superuser. :-) – Adam Liss Apr 29 '12 at 17:22
  • You could probably cut that down to 9999 in practice (or even 999; I use 1000). I've never found a history bigger than about 1000 to be useful. If I want to recover a command to make it into a script, I normally do that well within a thousand commands. Otherwise, it can go and there's no harm done. – Jonathan Leffler Apr 29 '12 at 17:23
  • @JonathanLeffler: Mine is 1300 lines, and it's as small as I can make it. Ctrl-R is very useful. – l0b0 Apr 30 '12 at 12:45

it is indeed not (well) documented and I guess 99% of the bash user on this planed do set HISTSIZE to a veeery large number.

In the GNU bash history is handled through the mighty readline library. The library has the option to limit the history size ("stifle" in readline jargon) or not and bash simply sets the readline history to stifled/unstifled. If you look into e.g. GNU bash version 4.2, file variables.c, line 4443, function void sv_histsize (char*) you'll find this comment (and the whole stifling/unstifling in the function that follows):

/* What to do after the HISTSIZE or HISTFILESIZE variables change.
If there is a value for this HISTSIZE (and it is numeric), then stifle the history. Otherwise, if there is NO value for this variable,
unstifle the history. If name is HISTFILESIZE, and its value is
numeric, truncate the history file to hold no more than that many
lines. */

So this should do the trick:

export HISTSIZE=""

And also this (if you feel defiant):


Hope this helps.

  • 2
    May the Tux bless you :) – meeDamian Jun 6 '14 at 20:02
  • 18
    I suggest: export HISTSIZE="INFINITE" – AmanicA Nov 27 '15 at 9:05

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.