Re: Common History across Shell



On Jul 10, 3:36 am, quarkLore <agarwal.prat...@xxxxxxxxx> wrote:

I am looking for a feature where if a user has multiple shells and on
a special keystroke / command all shells get a common history which is
sum of all histories.

Does such a feature exist in bash or any other shell?
Can such a feature be implemented without changing the shell's code?

Try this in .bashrc. Note the history of your session won't be
appended to the history file until you exit the session.

# 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

.



Relevant Pages

  • Re: [SLE] BASH History
    ... >> interactive BASH shells and one root shell running. ... >> write the history file, and I end up with only one of those shells' ... > history file, otherwise the history file is overwritten. ...
    (SuSE)
  • 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: Common History across Shell
    ... When the shell starts up, the history is initialized from the file ... named by the value of HISTFILE is truncated, if necessary, to contain ... history in file from each session *after* the particular session ...
    (comp.unix.shell)
  • Re: stdout -determining size of??
    ... My query comes about because I had a shell running for ages with ... Could you provide the error message that made you think that stdout has ... After getting the message I dumped the history and locate.updatedb ran ... That depends entirely on the shell. ...
    (freebsd-questions)
  • Re: redirect Temporary Internet Files via GP
    ... PART "TempIE Files" EDITTEXT ... PART "History" EDITTEXT ...
    (microsoft.public.windows.group_policy)