bash - deleting history

Disable saving history

Disable the Bash shell from saving the history

export HISTSIZE=0

This is useful if you want to disable command history temporarily for privacy or security reasons

Clear stored history

history -c

It removes all the commands stored in the current session’s history. HISTFILE will not be deleted .e. This command is useful in clearing the stored history

Delete the history of the current shell

history -w

It will write the current history to the history file. So after #Clear stored history and then #Delete the history of the current shell it will overwrite the HISTFILE

Shred the history file

shred ~/.bash_history

Piping dev/null into history file

cat /dev/null > .bash_history

Covering tracks and flee

~/.bash_history && cat /dev/null > .bash_history && history -c && exit

|447x335