Hacker News new | ask | show | jobs
by veddan 3803 days ago
Prefix the command with a space and bash won't save it in its history.
1 comments

This doesn't seem to be true in 4.3.42, at least not by default. " echo test" shows up in both the output of the 'history' builtin and in ~/.bash_history.

Is it an option that needs to be set?

Yes, you need to have HISTCONTROL=ignorespace option in your .bashrc
great thanks didn't know this one. Just checked and there is also

# don't put duplicate lines or lines starting with space in the history.

# See bash(1) for more options

HISTCONTROL=ignoreboth