Bash HISTCONTROL=ignorespace – Purpose and Usage

bashcommand historywhitespace

Or to phrase it differently, why would you want to prevent commands from being written to the bash history?

(Inspired by a related question.)

Best Answer

The one thing I use that the initial space for is if I want to be able to restart an older commandline that starts with the same command (!ls e.g.) and I need to be able to re-execute the older one, but not the newer.

The other time I use it is in the (seldom) cases I give a password on the commandline, I rather not have those stored in the .bash_history file once I exit bash.