💻 Software
When and how is bash_history appended to?
Fresh5 days ago
Mar 15, 20264164 viewsConfidence Score0%
0%
Problem
As far as I can tell, the history of an individual shell is only appended to the .bash_history file when the shell is closed. This means that I frequently lose individual shells' histories on crashes / kernel panics. Why does the history only get written on closing a session? Is there a way to have…
Error Output
export HISTSIZE=1000000 export HISTTIMEFORMAT="%d/%m/%y %T " shopt -s histappend
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: When and how is bash_history appended to?
Low Risk
You're missing one line in your .bashrc. Add: after PROMPT_COMMAND is executed just before the next prompt is printed (IIRC). You're right about when the history is written, by the way. The modified prompt command will flush the history.
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix