Sunday, October 25, 2009

Linux CLI - How to clear history

For fast clearing just type 'history -c' command that will clears the terminal history.

Another alternative by googling..

 1. Just put this command in your .bashrc file

a. If you don't even want to keep on in the first place
export HISTSIZE=0

b. Prevent less from creating a history file.
export LESSHISTFILE="-"

c.Prevent a bash history file from ever being saved.
unset HISTFILE


2. Your history will be available in ram for each bash session, but will be gone once you log out

rm -fr ~/.bash_history

ln -s /dev/null ~/.bash_history


3. You could add the following line to the end of your .bash_logout file:

rm -f .bash_history


Test it!!!

No comments:

Post a Comment