Skip to content

Clear Bash History Linux Shell Script Commands

 

Linux history command

On more than one occasion we have wanted to delete the history of the shell script. The bash commands that we have executed on our computer in linux.

Bash history

Delete the .bash_history file located in our home is an option, but it is always better to use the tools or options that the system itself offers .

 

Linux Clear History

We will learn two ways to do it. Through bash commands and shell script.

  • First:

History -c: So simple! A simple parameter (-c) tells the system to delete the command history.

  • Another method that should work is also:

Echo ""> ~ / .bash_history

This should put a blank line in our history deleting everything else

 

Easy and quick. Hope it helps!