If you were ever to create an image of your OS for example, but do not want to include your history.
It also wipes the history still in the memory.
cat /dev/null > ~/.bash_history && history -c && exit
Also, if you don’t even want that your command ends up in your bash history in the first place, add a space at the start of you command and it will not be in your bash history!
> echo "inhistory" > blaa
> echo "notinhistory" > blaa #notice the space
The “notinhistory” is not in the history file:
> history | tail -n1
10438 echo "inhistory" > blaa
Geef een reactie