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

1.

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

2.

>~/.bash_history && history -c


...