Keep all commands in bash history?

I think you are confused because of HISTCONTROL=ignoreboth. See here: http://www.linuxjournal.com/content/using-bash-history-more-efficiently-histcontrol


FWIW, I use HISTFILE=~/.bash_history_$(date '+%Y%m%d_%H_%M_%S_%N').txt in my .bashrc file to make a single history file for each session, with a timestamp. That way I don't lose commands when I hit $HISTSIZE commands. history only shows me the command history for the current terminal session, but I can easily search previous bash history with grep 'what to find' .bash_history*


I suspect that you're not doing quite what you think you're doing. Run frobiz: , then see if that's in your history. Frobiz should normally fail - there's no such command. But it will be in your history. I suspect that you are trying something like ls *![0-9], which will fail with

ls !(*.[0-9])
base ![0-9]": event not found

The thing is; when failing like this, bash never attempts to run the command, so it doesn't get put into the history. IGNOREBOTH is irrelevant to this - it works as advertised. Try escaping the ! (which the shell is taking to refer, ironically, to a command in the history) - eg:

ls \! ...

And it will probably work as expected.