Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
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
add comment

migrated from stackoverflow.com Sep 26 '12 at 9:21

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 11 down vote accepted

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):

export HISTSIZE="GOTCHA"

Hope this helps.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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