Clear Shell History In Ubuntu Linux

by on July 7, 2009 · 1 comment· last updated at July 7, 2010

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



You should follow me on twitter here or grab rss feed to keep track of new changes.

Featured Articles:

{ 1 comment… read it below or add one }

1 Jonas September 7, 2011 at 2:27 pm

guess you mean
echo ‘history -c’ >> ~/.bash_logout
…to clear history on logout?

Jonas

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <kbd> <blockquote> <pre> <a href="" title="">

Tagged as: , , , , , , , , ,

Previous Faq:

Next Faq: