DEV Community

TypeNaN
TypeNaN

Posted on

Unlimited Bash History

edit file .bashrc
Set HISTSIZE and HISTFILESIZE to an empty string:

HISTSIZE=
HISTFILESIZE=

In bash 4.3 and later you can also use HISTSIZE=-1 HISTFILESIZE=-1:

n. Setting HISTSIZE to a value less than zero causes the history list to be
unlimited (setting it 0 zero disables the history list).
o. Setting HISTFILESIZE to a value less than zero causes the history file size
to be unlimited (setting it to 0 causes the history file to be truncated
to zero size).

bash --version to check your bash version.

Change the file location because certain bash sessions truncate .bash_history file upon close.
http://superuser.com/questions/575479/bash-history-truncated-to-500-lines-on-each-login
Force prompt to write history after every command.
http://superuser.com/questions/20900/bash-history-loss
Use timestamp HISTTIMEFORMAT="[%F %T] "

Finally:

HISTSIZE=-1
HISTFILESIZE=-1:
HISTFILE=~/.bash_eternal_history
PROMPT_COMMAND="history -a; $PROMPT_COMMAND"

Top comments (0)