In a recent post I discussed how to search and run a command stored in the bash history. I mentioned that the history file can get quite large and after awhile you may want to clear it down. Maybe you want to see only the commands that you have recently used or maybe your just doing some house keeping. In any case deleting the contents of the bash history is pretty straight forward.
To delete the bash history simply type the following in a terminal:
The -c flag will clear the contents of the history which is stored in RAM
I also mentioned in my previous post that the contents of the history utility is stored in the file:
You can delete this file and all its contents by typing the following in the terminal:
rm -rf ~/.bash_history
In the example above the rm command (remove) will delete the .bash_history file. The rm command has the -r flag which means that it will recursively remove any sub directories that it has found (if any). The -f flag forces any removal without user interaction (as long as the -i flag is not supplied)
In this post I have shown how to remove the contents of the bash history which is stored in RAM and which is stored in the history file.