Clear Bash History Completely?

If you have linux server or linux operating system(distribution) in your pc then you are using bash. Bash is a command processor and Unix Shell, typically run in a text window, allowing the user to type commands which cause actions. Bash can also read commands from a file, called a script. Bash keep records of executing commands and all. Sometimes if you want to clean all your records you can follow this.

bash_image

~/.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 Debian Wheezy 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

I think this will do the work. 🙂
Thank You for reading and if it helps leave feedback.