Prevent Duplicates in Bash History

As you may have noticed, bash keeps a history. If you open your terminal and push the up arrow, you’ll see the last command you used. This fills up with duplicates. This is how you ensure it doesn’t keep duplicates.

It’s pretty easy. Just open your terminal and enter:

[code]echo ‘export HISTCONTROL=ignoreboth:erasedups’ >> ~/.bashrc[/code]

After that, bash should no longer keep duplicates of previously entered commands.

See? Linux is pretty simple.