For quite a long time I don't know why my bash stops remembering command history. I just figured out it was caused by some code like `eval return' in the .bashrc/.bash_profile.
Steps to reproduce (tested with 3.2.25, 4.0.28, 4.1.11 and 4.2.29): $ cp .bashrc .bashrc.old $ echo eval return > .bashrc $ bash $ cmd-not-found $ history 10 <-- You'll not see cmd-not-found in the output. $ <-- And you cannot find cmd-not-found by pressing the <Up> arrow key.