There are several options to disable saving commands to bash history e.g.

set +o history



How to start a new bash session with history disabled?

I tried bash +o history but it didn't work.

EDIT: I don't want to modify my rc or profile files. I just want to start a single bash session with a different configuration.

  • @DopeGhoti bash: history: invalid shell option name, +O is for shopt
    – timakro
    Aug 9, 2017 at 15:41

3 Answers 3

bash --init-file <(echo '. ~/.bashrc; unset HISTFILE')


bash --rcfile <(echo '. ~/.bashrc; unset HISTFILE')

And better put it in ~/.bash_aliases as permanent alias:

alias bash2="bash --init-file <(echo '. ~/.bashrc; unset HISTFILE')"
  • Another solution is to unset the HISTFILE variable before calling bash: HISTFILE= bash
    – Manolo
    Nov 7, 2021 at 15:17

If you want to permanently disable history you can add shopt -u -o history or set +o history to your ~/.bashrc, or /etc/profile. Then clear your history!

history -c

Add the set +o history option in:


(it might change depending on the distro)

Then clear the history with:

history -c

Log off and log on again.

  • I wrote the exact same thing couple minutes before you, why the repost? Aug 9, 2017 at 15:47
  • Sorry dude, I probably had a couple of tabs opened and your reply wasn't there when I first opened it.
    – Adonist
    Aug 10, 2017 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.