Bash history optimized settings


SUBMITTED BY: Guest

DATE: Feb. 5, 2015, 8:58 a.m.

FORMAT: Bash

SIZE: 499 Bytes

HITS: 710

  1. # Avoid duplicates, ignore two characters commands and those ones which starts with
  2. # a space. Preserve history in multiple terminal windows.
  3. export HISTCONTROL=ignoredups:erasedups
  4. export HISTCONTROL=ignoreboth
  5. export HISTCONTROL=ignorespaces
  6. export HISTIGNORE=??
  7. # After each command, append to the history file and reread it
  8. export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
  9. shopt -s histappend
  10. shopt -s checkwinsize

comments powered by Disqus