DEV Community

TypeNaN
TypeNaN

Posted on

2 1

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"

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay