Howto Clear Bash History in Linux

Sometime you need to clear bash history for some reason like privacy or something else. Clearing bash history is pretty simple just run this command in your linux terminal

history -c

Or

rm ~/.bash_history

Prevent Saving History

You can add the command to your ~/.bash_logout so that history will get cleared everytime you logout from terminal

echo 'history -c' >> ~/.bash_logout

Finding Max History Can Be Stored

echo $HISTSIZE
1000

My history stored in ~/.bash_history file can hold up to 1000 last commands

Leave a Reply

Your email address will not be published. Required fields are marked *