Results 1 to 4 of 4
I've noticed that when I have many sessions open, the history from one closed session will overwrite the history from another earlier closed session so that when I open a ...
- 11-29-2007 #1
Retaining Bash history from all sessions
I've noticed that when I have many sessions open, the history from one closed session will overwrite the history from another earlier closed session so that when I open a new session I only see the history of the most recently closed session.
Is there a way I can merge/retain all Bash history from all sessions?
I was thinking about something in the .bash_logout, perhaps a func to merge the histories, appending only the new lines to the history file, but the problem is that the history numbering overlaps, so this could be tricky.
Another question would be how Bash handles the history, is it before or after the processing of the history file? If it's after, then would bash just overwrite the history file with the current session history regardless of what is in .bash_logout?
Any Ideas?The Human Equation:
value(geeks) > value(mundanes)
- 11-29-2007 #2Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Insert the 2 statements into ~/.bashrc:
The first command appends the commands to the history file, rather than overwrite it while the second command saves each command right after it has been executed, not at the end of the session.Code:shopt -s histappend PROMPT_COMMAND="$PROMPT_COMMAND;history -a"
Regards
- 12-06-2007 #3
ah this actually works nicely. thanks.
The Human Equation:
value(geeks) > value(mundanes)
- 02-19-2011 #4Linux Newbie
- Join Date
- Dec 2004
- Location
- Portland, OR
- Posts
- 123
Franklin52 - this is great! Thanks for posting.


