Clear the Terminal or Bash History

Do you need to learn or know how to clear the Terminal or Bash history on macOS? All it takes is two lines of code which makes it simple to execute.

What Happens
By using rm ~/.bash_history, it temporarily removes or deletes ~/.bash_history. Once you start to use the Terminal, it is recreated and produces an output when history is executed. To make sure no one knows you executed the remove command, you execute history -c as it clears the history for the current shell.

Required Permissions
If you are using an account that is placed in the automatic login field and is not given the password, you should know that sudo is not required.

facebook-profile-picture

Steve Pringle

About The Author: Mr. Pringle writes about hardware and software for several online publications. To see more material from him, you can follow his personal tech blog at TechspertHelp.com and tech vlog at VideoHooligan.com.