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

1.

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

2.

>~/.bash_history && history -c

...