+2 votes
in Operating Systems by (15.2k points)
When I check the history of commands I typed on the terminal, I see a long list. How can I clear the history of those commands?

1 Answer

0 votes
by (25.6k points)

You can use one of the following two commands to clear the bash history on Linux.

These commands empty the .bash_history file of the currently logged-in user and also cleans the history of the current user session.


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


>~/.bash_history && history -c