4 ms·
Add this to your .bashrc: # History stuff. shopt -s histappend export HISTFILESIZE=50000 export HISTSIZE=50000 export HISTCONTROL=ignoreboth export
by zootboy 10y ago
Add this to your .bashrc:
# History stuff.
shopt -s histappend
export HISTFILESIZE=50000
export HISTSIZE=50000
export HISTCONTROL=ignoreboth
export PROMPT_COMMAND='history -a'
Individual shells keep their session history in order, while all commands regardless of which shell triggered them get appended to the history file.
- web007 10y ago# infinite history HOSTNAME="$(hostname)" HOSTNAME_SHORT="${HOSTNAME%%.*}" mkdir -p "${HOME}/.history/$(date -u +%Y/%m/)" > /dev/null 2>&1 SESSIONPREFIX=$(date -u +%Y/%m/%d.%H.%M.%S) export HISTFILE="${HOME}/.history/${SESSIONPREFIX}_${HOSTNAME_SHORT}_$$" Only thing you're missing is `HISTFILE`, and an alias like alias histgrep='find ~/.history/ -type f -print0 2>/dev/null | xargs -0 grep --color=auto -InH' https://news.ycombinator.com/item?id=10162189 https://news.ycombinator.com/item?id=10162189 for context
- jesrui 10y agoSame idea with some usage and backup tips: http://jesrui.sdf-eu.org/remember-all-your-bash-history-forever.html http://jesrui.sdf-eu.org/remember-all-your-bash-history-fore...