[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.

Share on Facebook2
Share on Google+1Tweet about this on TwitterShare on StumbleUpon1Share on LinkedIn5Share on Tumblr0Digg thisPin on Pinterest0Share on Reddit0Email this to someonePrint this page
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.

Review Overview

User Rating: Be the first one !

About Abhijit Sandhan

Abhijit Sandhan
Loves Linux, Blogging, Traveling, Hiking and sharing knowledge!

Leave a Reply

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

CAPTCHA