The default .bashrc
in the standard distribution of Ubuntu 16.04 that comes with AWS has these lines:
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
However, it doesn't seem to work. I have been running pm2 restart myApp
and pm2 list
repeatedly using the Up Arrow key, and the command buffer now contains nearly a hundred lines of these.
What could be wrong?
It's working as intended.
ignoredups
, implied byignoreboth
, doesn't add a command to history if it's the same as the immediate previous command. It doesn't look further back in history. From the manual:So, this will add
foo
twice to the history:But so will this:
The last
foo
won't be added to history, since the previous command wasfoo
. Useerasedups
in conjunction:So: