Skip to main content
spelling and style
Source Link
phk
  • 6.1k
  • 7
  • 44
  • 76

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 HISTIGNORE ignores all commands that don't have arguments. This may not be desireabledesirable by some folks and can be left out.

This is what I came up with and I am happy with it so 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 HISTIGNORE ignores all commands that don't have arguments. This may not be desireable by some folks and can be left out.

This is what I came up with and I am happy with it so 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 HISTIGNORE ignores all commands that don't have arguments. This may not be desirable by some folks and can be left out.
added secondary sort to ensure the older duplicate is always removed
Source Link

This is what I came up with and I am happy with it so 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 HISTIGNORE ignores all commands that don't have arguments. This may not be desireable by some folks and can be left out.

This is what I came up with and I am happy with it so far...

alias hfix='history -n && history | sort -k2 | 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 HISTIGNORE ignores all commands that don't have arguments. This may not be desireable by some folks and can be left out.

This is what I came up with and I am happy with it so 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 HISTIGNORE ignores all commands that don't have arguments. This may not be desireable by some folks and can be left out.
fixed HISTIGNORE. wasn't working as desired.
Source Link

This is what I came up with and I am happy with it so far...

alias hfix='history -n && history | sort -k2 | 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  
#exportexport HISTIGNORE="&:[^HISTIGNORE="!(+(*\ \t]*"*))"  
PROMPT_COMMAND="hfix; $PROMPT_COMMAND" 

NOTES:

  • Yes, it is complicated... but, it removes all duplicates and yet preserves chronology within each terminal!
  • my HISTIGNORE ignores all commands that don't have arguments. This may not be desireable by some folks and can be left out. **BUMMER: better leave this out. It doesn't work! Anyone know why?

This is what I came up with and I am happy with it so far...

alias hfix='history -n && history | sort -k2 | uniq -f1 | sort -n | cut -c8- > ~/.tmp$$ && history -c && history -r ~/.tmp$$ && history -w && rm ~/.tmp$$'  
HISTCONTROL=ignorespace  
shopt -s histappend  
HISTSIZE=1000  
HISTFILESIZE=2000  
#export HISTIGNORE="&:[^ \t]*"  
PROMPT_COMMAND="hfix; $PROMPT_COMMAND" 

NOTES:

  • Yes, it is complicated... but, it removes all duplicates and yet preserves chronology within each terminal!
  • my HISTIGNORE ignores all commands that don't have arguments. This may not be desireable by some folks and can be left out. **BUMMER: better leave this out. It doesn't work! Anyone know why?

This is what I came up with and I am happy with it so far...

alias hfix='history -n && history | sort -k2 | 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 HISTIGNORE ignores all commands that don't have arguments. This may not be desireable by some folks and can be left out.
HISTIGNORE commented out since it doesn't work properly. Anyone know why?
Source Link
Loading
added 36 characters in body
Source Link
Anthon
  • 81.4k
  • 42
  • 174
  • 228
Loading
Source Link
Loading