News for hackers. Stuff that matters.
Re:Unix Tricks by Tiksi on Thursday July 03, 2014 @04:08AM (#7982031)
Here you go, just throw it in your .bashrc:

  shopt -s histappend
  export HISTSIZE=100000
  export HISTFILESIZE=100000
  export HISTCONTROL=ignoredups:erasedups
  export PROMPT_COMMAND="history -a;history -c;history -r;$PROMPT_COMMAND"
I wish I could give credit to where I originally found this but it was ages ago.
Re:Unix Tricks by gknoy on Thursday July 03, 2014 @01:06PM (#7984280)
I've been using `history -a`, but what do `history -c` and `history -r` do?

It looks like it clears your shell's history, and then re-populates it from the .bash_history file?

Re:Unix Tricks by Flenser on Friday July 04, 2014 @04:28AM (#7987857)

   history -a  # append history lines from this session to the history file.
   
   #History file may contain history from other terminals not in this one so:

   history -c # clear [in-memory] history list deleting all of the entries.
   history -r # read the history file and append the contents to the history list instead.
I've heard that -n can be problematic which is why -c then -r is used.
Re:Unix Tricks by mtford on Thursday July 03, 2014 @05:50AM (#7982228)
Many thanks for this! This has been a thorn in my side for a while but never got round to doing anything about it...
Re:Unix Tricks by grimgrin on Thursday July 03, 2014 @09:59AM (#7983072)
Don't you want HISTCONTROL=ignoreboth ?