Since I'm saving history from different sessions this is an issue where
erasedups can't help because I'm using the following:
Is there an easy way to delete duplicates in 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
cp unduped_history ~/.bash_history
I would also recommend to put the following in your ~/.bashrc: