+2 votes
in Operating Systems by (71.8k 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

+1 vote
by (353k points)
selected by
Best answer

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