Bash does not remember programs with non 0 exit status in history

Solution 1:

For my it still works as you describe it should, but maybe you need to look for something in the ~/.bashrc file that prevents some commands from showing up in the history, maybe something as described in here: http://blog.dhampir.no/content/avoiding-invalid-commands-in-bash-history

Solution 2:

It does keep commands in the history regardless of exit status.

Check the value of HISTIGNORE: set | grep HISTIGNORE

I thought I was going crazy when I was purposely testing some failed commands, but they were not showing up in history. Then I realized I had HISTIGNORE="?:??", which ignores 1 and 2 letter commands (I was testing 2 letter commands).