This is what I came up with and I am happy with it so far...far…
alias hfix='history -n && history | sort -k2 -k1nr | uniq -f1 | sort -n | cut -c8- > ~/.tmp$$ && history -c && history -r ~/.tmp$$ && history -w && rm ~/.tmp$$'
HISTCONTROL=ignorespace
shopt -s histappend
shopt -s extglob
HISTSIZE=1000
HISTFILESIZE=2000
export HISTIGNORE="!(+(*\ *))"
PROMPT_COMMAND="hfix; $PROMPT_COMMAND"
NOTES:
- Yes, it is complicated... but, it removes all duplicates and yet preserves chronology within each terminal!
- my HISTIGNOREMy
HISTIGNOREignores all commands that don't have arguments. This may not be desireabledesirable by some folks and can be left out.