Wednesday, April 30, 2014

Clearing bash history

~/.bash_history holds the history.
To clear the bash history completely on the server. You can open terminal and type cat /dev/null > ~/.bash_history
Other alternative way is to link ~/.bash_history to /dev/null
On my Ubuntu 12.10 box, The history comes back when I login back. I guess because the history entries has a copy in the memory and it will flush back to the file when you log out. The following command worked for me.
cat /dev/null > ~/.bash_history && history -c && exit

No comments:

Post a Comment

bee-social