Is there a way to define an unlimited history in Bash ?
Best Answer
Add this to your .bashrc (Linux) or .bash_profile (MacOS):
export HISTFILESIZE=
export HISTSIZE=
There you go, unlimited history. Currently I have 27000 entries :)
From man bash:
If HISTFILESIZE is not set, no truncation is performed.
That means .bash_history is never truncated
Also the same seems to apply to HISTSIZE, although I couldn't find that documented.
Another neat feature I'm going to try is this:
If the HISTTIMEFORMAT variable is set, time stamps are written to the history file, marked with the history comment character, so they may be preserved across shell sessions, like the following:
Best Answer
Add this to your
.bashrc
(Linux) or.bash_profile
(MacOS):There you go, unlimited history. Currently I have 27000 entries :)
From
man bash
:That means
.bash_history
is never truncatedAlso the same seems to apply to
HISTSIZE
, although I couldn't find that documented.Another neat feature I'm going to try is this:
Let me know if you have tried that already...