Avoiding duplicate entries in command-line using Bash
To keep your Bash history organized and avoid duplicate entries, you may add the following configuration line to your .bashrc file:
Or simply run this command:
cd; sed -i '$ a\export HISTCONTROL=ignoredups:erasedups' .bashrc
Done! Next time you log in, the duplicate commands will be long gone.