On Jan 31, 2012 11:08 AM, "Ivan Yosifov" <iyosi...@gmail.com> wrote: > > On Mon, 2012-01-30 at 20:16 +0200, Pierre Gaston wrote: > > On Mon, Jan 30, 2012 at 8:01 PM, Ivan Yosifov <iyosi...@gmail.com> wrote: > > > Hi everyone, > > > > > > I got an admittedly basic question but I'm really at my wits' end with > > > this. > > > > > > How do I enable infinite command history ? > > > > > > One simple suggestion I've seen online is to set HISTSIZE and > > > HISTFILESIZE to a large number. This is not what I need, I want > > > genuinely unconstrained history file growth. > > > > > > Another idea I've seen is to unset HISTSIZE and HISTFILESIZE. This > > > doesn't seem to work, the history file is being cropped to the default > > > of 500 lines. > > > > > > I'm probably missing something obvious but any help is appreciated. I'm > > > running Bash 4.1.5 (Debian Squeeze). > > > > I don't think there is a way. > > But do you plan to use bash normally? > > Setting HISTFILESIZE to 2147483647 gives you 68 years of history at > > one command per seconds > > (I hope I got my math right) > > with say 5 chars per commands it's something like 5GB of history. > > On Mon, 2012-01-30 at 20:16 +0200, Pierre Gaston wrote: > On Mon, Jan 30, 2012 at 8:01 PM, Ivan Yosifov <iyosi...@gmail.com> > wrote: > > > Hi everyone, > > > > > > I got an admittedly basic question but I'm really at my wits' end > with > > > this. > > > > > > How do I enable infinite command history ? > > > > > > One simple suggestion I've seen online is to set HISTSIZE and > > > HISTFILESIZE to a large number. This is not what I need, I want > > > genuinely unconstrained history file growth. > > > > > > Another idea I've seen is to unset HISTSIZE and HISTFILESIZE. This > > > doesn't seem to work, the history file is being cropped to the > default > > > of 500 lines. > > > > > > I'm probably missing something obvious but any help is appreciated. > I'm > > > running Bash 4.1.5 (Debian Squeeze). > > > > I don't think there is a way. > > But do you plan to use bash normally? > > Setting HISTFILESIZE to 2147483647 gives you 68 years of history at > > one command per seconds > > (I hope I got my math right) > > with say 5 chars per commands it's something like 5GB of history. > > > Thank you for stating it clearly. I suppose I'll either use the above > number or mess a bit with the source. > > My actual use case for this is as follows: > > Sometimes I run some useful and non-trivial command that I don't want to > bother writing down somewhere separate but I want to be able to find > later by grepping the history file. For example, more than a year ago I > used a pipeline to convert a .flac music file to .mp3. I still remember > the the name of the song involved so I could easily find the command > with grep (if the history file still had it, of course). > > On the other hand, I do a lot of work from the shell anyway. So the > history file gets flooded with trivia like make invocations, cd <some > autocompleted name that could be 200 characters long>, etc, etc. > > In the end, I had set HISTFILESIZE to some supposedly large number and a > year later I couldn't find the flac->mp3 command any more, so I wanted > the history rotation turned off entirely. I got hundreds of GB of free > hdd space so I absolutely don't care about the size of the history file. > Maybe my limit wasn't large enough (wasn't 2147483647 though was still > "big") or maybe I messed up something else and it didn't work. > > >
I have the same use case. Try one of my logging functions at http://stackoverflow.com/945288/26428 By setting it up to use a separate logging file, you can accumulate as much history as you like. It also saves the current directory and other information. The Bash history file will still function normally.