Clear Terminal command history
I'm trying to clear the history of commands that have been run on Terminal, I found an article which said I can do it with rm ~/.bash_history
However, I am still able to see the previous commands that I've ran by pressing the up arrow
Solution 1:
The correct command is history -c
, as shown in the picture below.
Solution 2:
An easy way to accomplish this is to close all terminal windows, and then open a single new terminal window, where you run:
rm ~/.bash_history
You'll need to close the terminal and open it again. Now when you press arrow up, you'll only see the rm command, and not earlier commands.