Is there a way to define an unlimited history in Bash ?
migrated from stackoverflow.com May 4 '10 at 12:06
This question came from our site for professional and enthusiast programmers.
put that into .bashrc:
There you go, unlimited history. Currently I have 27000 entries :)
From "man bash":
That means .bash_history is never truncated
Also the same seems to apply to HISTSIZE, although I couldnt find that documented.
Another neat feature I'm going to try is this:
Let me know if you have tried that already...
(reposting my answer from http://stackoverflow.com/a/19533853/128597)
After many large, ugly iterations and weird edge cases over the years, I now have a concise section of my .bashrc dedicated to this.
First, you must comment out or remove this section of your .bashrc (default for Ubuntu). If you don't, then certain environments (like running
Second, add this to the bottom of your .bashrc:
Note: every command is written immediately after it's run, so if you accidentally paste a password you cannot just "kill -9 %%" to avoid the history write, you'll need to remove it manually.
Also note that each bash session will load the full history file in memory, but even if your history file grows to 10MB (which will take a long, long time) you won't notice much of an effect on your bash startup time.
Include in ~/.bashrc:
This answer satisfies the following criteria:
On interactive startup, if
tips for OSX (Terminal)
Every time a tab is created in Terminal,
tips for screen
If you use screen, your configuration file is ~/.screenrc. If you want screen to record history, you just need to set it to use a login shell which will source your bash startup files (and record your history).
A different concept (may not be applicable) but you can have