[Cialug] How to add multiple instances of bash to your bash history

Adam Hill adam at diginc.us
Wed Mar 19 23:55:27 CDT 2014


Here is my standard history setup from ~/.bashrc

export HISTSIZE=100000
export HISTFILESIZE=50000
export HISTCONTROL=ignoredups
export PROMPT_COMMAND="history -a; history -n; $PROMPT_COMMAND"

the -a submits your recent commands so other sessions see them, the -n
pulls the hitsory back into your session so you can see your other
sessions' history.

	      -a     Append  the  ''new'' history lines (history lines entered
		     since the beginning of the current bash session)  to  the
		     history file.
	      -n     Read  the history lines not already read from the history
		     file into the current  history  list.   These  are	 lines
		     appended  to  the history file since the beginning of the
		     current bash session.

You still usually have to press return once to see your other session's
histories but it works great besides that little quirk




On Wed, Mar 19, 2014 at 8:35 PM, Andrew Denner <linux-list at upeke.com> wrote:

> As was discussed at the meeting tonight, by default bash only writes the
> last bash session running to the history blowing away any other instances.
> Per
> http://www.aloop.org/2012/01/19/flush-commands-to-bash-history-immediately/
>
> If you add: "export PROMPT_COMMAND='history -a'" To your .bashrc file it
> will append each command immediately to your bash history file
>
> On Tuesday, March 18, 2014, Barry Von Ahsen <vonahsen at gmail.com> wrote:
>
> > screen vs. tmux vs. byobu
> >
> > 7pm at Alliance
> >
> > http://www.cialug.org/?page_id=7&event_id=1030
> > _______________________________________________
> > Cialug mailing list
> > Cialug at cialug.org <javascript:;>
> > http://cialug.org/mailman/listinfo/cialug
> >
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug
>


More information about the Cialug mailing list