Clearing .bash_history
November 2, 2020
Clearing history is easy, right? You just run history -c
right? Well, sure but then when you log out your history will show you exiting.
When creating virtual machine templates I like to leave the history blank because it’s clean and I don’t get in the way of anyone or leave accidental secrets in there. Here’s a great one-liner to clear the history and log out so you don’t leave anything behind;
cat /dev/null > ~/.bash_history && history -c && exit
Leave a Reply