Other ways to do this here as well: [https://superuser.com/questions/722461/how-can-you-remove-duplicates-from-bash-history][1] Also `sort ~/.bash_history | uniq -u` or in vim text editor [`:sort u`][2] If some of the suggestions including the ones above don't work immediately. After running the code I do: history -c to clear the history first then restore the no duplications version over it: cp temp.txt ~/.bash_history [1]: https://superuser.com/questions/722461/how-can-you-remove-duplicates-from-bash-history [2]: https://stackoverflow.com/a/29418407/3426192