I would like to ignore some commands in bash history, for example exit, history...
I try HISTIGNORE="history:history :exit:exit " and it's not filtering out the commands.
How to make sure that the $HOME/.bash_history doesn't contains some specific bash commands?
If you want exact matches for the commands to be ignored:
$export HISTIGNORE="history:exit"Put the above shell variable export in your
.bashrcfile so that the next time you login to bash the earlierHISTIGNOREsetting continues to be effective.If you don't want any lines beginning with the
historycommand, likehistory -athen put this into your.bashrcfile:$export HISTIGNORE="history*:exit"If you don't want any commands to be saved into the history, put:
$export HISTIGNORE="*"Check your
HISTIGNOREsetting:$echo "$HISTIGNORE"From
man bash:Each colon-separated list of patterns is anchored at the beginning of the line and must match the complete line. (no implicit '*' is appended). Each pattern is tested against the line after the checks specified by
HISTCONTROLare applied.