+2 votes
in Operating Systems by (75.9k points)

I can see all the commands that I typed on the terminal using history command. How can I clear the history?

1 Answer

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

You need to clear the content of file '.bash_history' to clear the bash history. You can try one of the following approaches:

1.Run the following command on the terminal:

cat /dev/null > ~/.bash_history

2. Open '.bash_history' and manually delete everything from the file.

vi ~/.bash_history

and delete the content.