Let's say I type the following sequence of commands:$ cd$ ls$ lsWhen I go back in history by pressing up twice, I end up with cd, instead of ls.I've noticed this isn't always the case, so it likely is some bash setting somewhere. Which is it?
Where is the setting that disallows duplicate command history?
bash;command history
The is controlled by the HISTCONTROL variable.  If is contains ignoredups, then duplicate commands will not be saved in the history.  Without this string, they will be saved.  This would be normally set in .profile or .bashrc, using something likeexport HISTCONTROL=ignoredupsOther values that can be used in HISTCONTROL (multiple can be used, separated by :)ignorespace any commands starting with a space are not added to the historyerasedups duplicate commands are erased from the history, so the history only contains the latest commandignoreboth identical to ignoredups:ignorespace 