How to Clear BASH History in Linux, Centos, Debian and Ubuntu
If you don’t want to save history in Bash, since the commands may contain data such as passwords. This article will help keep Bash history in check.
How to completely delete the Bash history:
-c - Clear history file
-w - add commands of the current session to the history file
# history –cw
How to remove a specific line from the Bash history:
-d - Delete the line with the specified number from the history
# history -dw 352
How to clear command history of current session:
-r - Read the current history file and add its contents to the command history list.
# history -r
How don't save command in Bash history:
How to run the command without putting it in the history of Bash:
# 'space' command
Put a space before any command and it will not be saved in Bash history.
How don't save all commands of the current session in the history of Bash:
If you will disable the HISTFILE results in the fact that until you exit the current session, any commands you will execute will not be saved in a file with the bash_history history:
# unset HISTFILE