As you know, bash keeps a history of the commands used in your user’s session. But, when you use a command twice (or more), it will be saved with two (or more) entries in the bash history.
The best way to get rid of the duplicated entries is to add this in your ~/.bashrc file.
$ echo 'export HISTCONTROL=ignoreboth:erasedups' >> ~/.bashrc
Explenation, from the bash manual:
HISTCONTROL=ignoreboth:erasedups – ignore the duplicates and the command starting with space and remove the previous line matching with the line of the current command.
HISTCONTROL=ignoreboth – ignore the duplicates and the commands starting with spaces.
HISTCONTROL=ignoredups – ignore only the duplicates.
HISTCONTROL=ignorespace – ignore only the commands starting with space.