Re: Common History across Shell



# make Bash append rather than overwrite the history on disk:
shopt -s histappend

When the shell starts up, the history is initialized from the file
named by the HISTFILE variable (default `~/.bash_history'). The file
named by the value of HISTFILE is truncated, if necessary, to contain
no more than the number of lines specified by the value of the
HISTFILESIZE variable. When an interactive shell exits, the last
$HISTSIZE lines are copied from the history list to the file named by
$HISTFILE. If the histappend shell option is set (see section 4.2 Bash
Builtin Commands), the lines are appended to the history file,
otherwise the history file is overwritten. If HISTFILE is unset, or if
the history file is unwritable, the history is not saved. After saving
the history, the history file is truncated to contain no more than
$HISTFILESIZE lines. If HISTFILESIZE is not set, no truncation is
performed.

HTH

rd

What you are describing is a little different. This will append
history in file from each session *after* the particular session
exits. What I wanted was multiple sessions can share history (the
history maintained in RAM and not file) amongst themselves during
active session.
The need is that a user who has two or more sessions open and he has
typed some extremely long command in one of them. It becomes a pain to
retype on other shell session. So on a keystroke he may want to merge
all the histories without exiting the second session.

What frank has told for zsh is what I want for bash

.



Relevant Pages

  • Re: Common History across Shell
    ... history in file from each session *after* the particular session ... What I wanted was multiple sessions can share history (the ... Shell might behave the normal way (maintain ... done on a specific user action. ...
    (comp.unix.shell)
  • Re: How to disable command prompt history?
    ... > executed commands by pressing Up Arrow? ... That would depend on which shell you are running. ... But you can avoid writing the history of the current session to the ... So next time when you login the history of the previous session will ...
    (freebsd-questions)
  • Re: [SLE] BASH History
    ... Randall wrote regarding 'BASH History' on Sat, ... > interactive BASH shells and one root shell running. ... > history file, and I end up with only one of those shells' history. ... file named by the value of HISTFILE is truncated, ...
    (SuSE)
  • Re: History and Last cleared ??
    ... Is it supposed to keep these entries into eternity or do they ... any history, esp in root acct, is highly suspect. ... Unless you deleted the $HISTFILE and changed the values of ... if you can't think of a logical reason that command history should ...
    (comp.os.linux.security)
  • Re: Common History across Shell
    ... Note the history of your session won't be ... When the shell starts up, the history is initialized from the file ... named by the value of HISTFILE is truncated, if necessary, to contain ... Builtin Commands), the lines are appended to the history file, ...
    (comp.unix.shell)