LinuxOperating Systems

[How To] Clear bash history in Linux

Sometimes, sensitive commands are present in your server bash history. Another user logging in the server will be able to access history of your commands as Linux stores command in the .bash_history file of the user.

To delete / clear the bash history of a user, execute following command:

history -c && history -w

The above command will clear bash history and generate an empty .bash_history file.

Abhijit Sandhan

Loves Open Source, Blogging, Traveling, Hiking and sharing Knowledge!

Leave a Reply

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

Back to top button