I want my .bash_history file to be unlimited. e.g. So I can always go back and see how I built/configured something, or what that nifty command was, or how some command broke something weeks ago. How do I change this setting?
Join Stack Overflow to learn, share knowledge, and build your career.
closed as off-topic by Toto, Pragnesh Chauhan, rds, rcs, Stefan Steiger Oct 23 '13 at 10:08This question appears to be off-topic. The users who voted to close gave this specific reason:
|
|||||||||
|
|||||||||
|
Set
In bash 4.3 and later you can also use
|
|||||||||||||||||||||
|
|
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. |
|||||||||||||||||||||
|
|
As Jörg Beyer mentioned above, In addition, you should definitely check out the environmental variable Links: here, and working with bash history. The bash Variable FAQ is also worth browsing. |
|||||||||||||||||
|
|
There are (at least) two relevant env vars here:
I think that we can agree that the term unlimited is often the same as very big (or do you have unlimited file storage?). So just set the values very large. |
|||||||||||||
|