I recently had to execute a command that I did not want bash to save in its history.

After a little searching, I finally understood what this little variable HISTCONTROL does. Definitely seen it around, never bothered with it; one of those things.

As long as it is set to either ignoreboth or ignorespace, anything starting with a space will not be saved to history.

 echo "Hello world!"

The command will still execute as normal, but that extra space makes a difference. Continue reading with an authoritative article on LinuxJournal.com from 2009.

Join the discussion on Mastodon, Twitter, or write me an email.