How to Delete All Bash History on Linux

0 Shares

Sometimes we want to delete the history of the commands we have typed in the Linux shell.
The commands below will work on all Linux distributions (CentOS, Debian, Ubuntu, etc.)

To delete History Bash on Linux, use a combination of these 3 commands:

cat /dev/null > ~/.bash_history && history -c && exit

What are the functions of this command?

The “cat” command cleans the bash_history file from the user who is currently logged in.
The “history -c” command clears the history of the current user’s session.
The “exit” command exits the current session.

Hopefully how to delete all the history of Bash on Linux in this tutorial useful.

You May Also Like

Leave a Reply

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