Making an never ending ‘history’ file

One useful feature in bash is that you can recall previously used commands (using arrow keys). You can also recursively search your history by pressing Ctrl + r and typing the command name, which brings up the matching commands. It will also lets you cycle through all matching commands by pressing Ctrl + r repeatedly. This is only helpful, if your history file is big. By default, $HISTFILE holds only limited number of entries (1000 lines or commands). You can easily hack it, so that you can store unlimited number of entries. Simply follow these steps:
First, in your .bashrc file, set these variables

export HISTSIZE=
export HISTFILE=~/.bash_eternal_history

This will make your history file unlimited! Other useful feature that you can use is setting $HISTTIMEFORMAT variable. This will write time stamps in the history file, marked with the history comment character, so they may be preserved across shell sessions.

export HISTTIMEFORMAT="[%F %T] "

Now start making a never ending history!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s