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"

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

πŸ‘‹ Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay