DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 967,911 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
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)

Image description

Join the One Year Club

You can earn this badge by being a registered member of the DEV Community for at least one year. Create an account and get started today.