3 ms·
> command I run in one shell session is not immediately available as a history item in other concurrent shell sessions this can be solved in vanilla bash by ad
by tryauuum 1y ago
> command I run in one shell session is not immediately available as a history item in other concurrent shell sessions
this can be solved in vanilla bash by adding these lines to .bashrc (be sure to remove other HIST* configs options from it)
shopt -s histappend
export HISTSIZE=100000
export HISTFILESIZE=100000
export HISTTIMEFORMAT="%F %T "
export HISTCONTROL=ignoredups:erasedups
export PROMPT_COMMAND="history -a;history -c;history -r;$PROMPT_COMMAND"
additionally, you need to restart or close all the bash sessions to be sure no copy of bash with old settings exists
- pabs3 1y agoI recommend a few changes to these: Infinite history instead of a large limit: HISTFILESIZE=-1 HISTSIZE=-1 Also ignore commands starting with a space: HISTCONTROL=ignorespace:ignoredups:erasedups Enable history substitution to verify commands before running them: shopt -s histverify shopt -s histreedit Write commands to history files before running the commands instead of after the commands finish: trap 'history -a' DEBUG Or if you already have a DEBUG trap: trap "history -a ; $(trap -p DEBUG | cut -d "'" -f 2)" DEBUG