I enter a command. It fails. I press arrow up, modify something and enter it again ... hold it right there.

It used to work like that. Now it's more like: I enter a command. It fails. I press arrow up, get the last command which didn't fail, likely "ls" or something useless and I type the whole thing again back by hand.

What happened? It wasn't always like this. But it's quite some time since this behavior changed, I'll give you that. Some years ago, at least. How do I put some sanity back into my bash prompt?


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

  • 1
  • Why would you post the exact same question? Now I wasted my time on a question that was already answered... – Gerhard Burger Dec 7 '12 at 17:03
  • There is considerable overlap between these two sites. – Prof. Falken Dec 7 '12 at 17:42
  • Yeah, that was my point, they both are part of stackexchange. So the common practice is to ask a question on only one of them, there is also the option to move a question to one of the other sites if that site is a better fit for the question. Well anyway, glad you got it solved. – Gerhard Burger Dec 7 '12 at 18:20
  • 2
    Sorry, at least they are linked now for posterity. – Prof. Falken Dec 7 '12 at 18:59

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).

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.