Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Prefix the command with a space and bash won't save it in its history.


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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: