Monday, April 30, 2012

Clear Shell History In Ubuntu Linux

How do I clear the shell history in Ubuntu Linux?

To clear the history, type the following command:
history -c
OR
rm ~/.bash_history
You can add the command to your ~/.bash_logout so that history will get cleared when you logout:
echo 'history -c' >> ~/.bash_history

Prevent A Bash History File From Ever Being Saved

Add the following commands to ~/.bashrc file:
echo 'unset HISTFILE' >> ~/.bashrc
echo 'export LESSHISTFILE="-"' >> ~/.bashrc

No comments:

Post a Comment