Clear the Terminal or Bash History

Do you need to learn or know how to clear the Terminal or Bash history on macOS? I notice that it tracks what was entered previously by myself or those sharing the system so when I am done in the Terminal, I enter the following.

rm ~/.bash_history; history -c (Works in macOS Catalina and later.)

It is two lines of code that are separated by a semicolon to make 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.

The following two tabs change content below.
facebook-profile-picture

Stephan Pringle

Technology Support Specialist at Sipylus
About The Author: Stephan Pringle is an Information Technology Support Specialist. He covers hardware and software and provides tips for you to troubleshoot and repair issues on your own. In his spare time, he writes articles about the State of New York on his Hackintosh and HackBook and that has helped him to become the top contributor of the New York City section of Yahoo! Answers.
facebook-profile-picture

Latest posts by Stephan Pringle (see all)

facebook-profile-picture

Stephan Pringle

About The Author: Stephan Pringle is an Information Technology Support Specialist. He covers hardware and software and provides tips for you to troubleshoot and repair issues on your own. In his spare time, he writes articles about the State of New York on his Hackintosh and HackBook and that has helped him to become the top contributor of the New York City section of Yahoo! Answers.