How can you remove duplicates from bash history?
It is possible to remove duplicated lines which are already in .bash_history by running
nl ~/.bash_history | sort -k 2 -k 1,1nr| uniq -f 1 | sort -n | cut -f 2 > unduped_history
followed by
cp unduped_history ~/.bash_history
I would also recommend to put the following in your ~/.bashrc:
export HISTCONTROL=ignoreboth:erasedups