Every now and then we realize that there’s a tip that we haven’t covered, and even when it’s as simple as clearing your terminal history, we feel compelled to write about it. Here’s how to clear your history on Linux or Mac OS X.
It’s really simple. Just type this command:
Our job is done. Your history is cleared.
In case you were wondering, all that history is stored in the ~/.bash_history file — that tilde and slash represent your user folder, so it’s really something like /home/username/.bash_history and it contains all of the commands you’ve typed at the terminal.
You could, of course, just edit that file to remove the line that you’re trying to get rid of. Because you’d never type a password in clear text, right?