Post

Dedup BASH History

One-liner to dedup Bash History.

1
2
3
4
5
6
# Remove duplicates
nl ~/.bash_history | sort -k 2  -k 1,1nr| uniq -f 1 | sort -n | cut -f 2 > unduped_history

# Replace history file
cp unduped_history ~/.bash_history
rm -f unduped_history
This post is licensed under CC BY 4.0 by the author.