Hacker News new | past | comments | ask | show | jobs | submit login

I took the bash-history related stuff from https://github.com/mrzool/bash-sensible and have been VERY happy with it. Among other things, it makes sure all your histories from various open terminals get merged, not overwrite each other -- I think maybe just `shopt -s histappend` is enough for that? But I was messing around with my settings regarding history settings for a while tweaking and tweaking, until I found bash-sensible, tried it out cut and paste, and found it was perfect.

## SANE HISTORY DEFAULTS ##

# Append to the history file, don't overwrite it

shopt -s histappend

# Save multi-line commands as one command

shopt -s cmdhist

# Record each line as it gets issued

PROMPT_COMMAND='history -a'

# Huge history. Doesn't appear to slow things down, so why not?

HISTSIZE=500000

HISTFILESIZE=100000

# Avoid duplicate entries

HISTCONTROL="erasedups:ignoreboth"

# Don't record some commands

export HISTIGNORE="&:[ ]*:exit:ls:bg:fg:history"

# Useful timestamp format

HISTTIMEFORMAT='%F %T '




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: