Bash – Duplicates in bash history

bashcommand history

I have the following in my ~/.bashrc

HISTCONTROL=ignoreboth:erasedups

However my history contains many duplicates e.g. I have 5 entries for sudo apt-get upgrade.

I am running Raspbian Jessie and principally access via ssh.

PS I just entered sudo apt-get upgrade while writing this and now only have a single entry.
Any idea why, and how I can prevent it?

Best Answer

No need of erasedups as you are already giving ignoreboth.

Ignoreboth will take care of duplicates and white space commands.

Just try only ignoreboth or erase dups.

"HISTCONTROL=ignoreboth"

Use only this and reload bash . Thank you.

Related Question