From: unruh on 18 Apr 2010 20:43 I am wondering where the bash history is kept-- the one which ! selects. I know about .bash_history, but that is NOT necessarily what the ! uses. I once upon a time by accident did slay unruh ( where slay is an alias for kill for any ps line that includes the next word) I also use slrn on another machine. The other day I by accident did !sl on the first machine and it reran slay unruh which destroyed the system (it did horrible things to the video card which only a reboot would solve). But looking in .bash_history, there was no "slay unruh" in there. I did a grep -r in /tmp, /var, ~unruh/tmp and nowhere did that phrase occur. Where the hell is the history kept? Also the history seems to be different for each open Konsole.
From: David W. Hodgins on 18 Apr 2010 22:00 On Sun, 18 Apr 2010 20:43:34 -0400, unruh <unruh(a)wormhole.physics.ubc.ca> wrote: > Where the hell is the history kept? Also the history seems to be > different for each open Konsole. In ram, for each bash session. From man bash ... On startup, the history is initialized from the file named by the variable HISTFILE (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 HIST‐ FILESIZE. When the history file is read, lines beginning with the history comment character followed immediately by a digit are interpreted as timestamps for the preced‐ ing history line. These timestamps are optionally displayed depending on the value of the HISTTIMEFORMAT variable. When an interactive shell exits, the last $HISTSIZE lines are copied from the history list to $HISTFILE. If the histappend shell option is enabled (see the description of shopt under SHELL BUILTIN COMMANDS below), the lines are appended to the history file, otherwise the history file is overwritten. Regards, Dave Hodgins -- Change nomail.afraid.org to ody.ca to reply by email. (nomail.afraid.org has been set up specifically for use in usenet. Feel free to use it yourself.)
From: unruh on 19 Apr 2010 02:13 On 2010-04-19, David W. Hodgins <dwhodgins(a)nomail.afraid.org> wrote: > On Sun, 18 Apr 2010 20:43:34 -0400, unruh <unruh(a)wormhole.physics.ubc.ca> wrote: > >> Where the hell is the history kept? Also the history seems to be >> different for each open Konsole. > > In ram, for each bash session. From man bash ... > > On startup, the history is initialized from the file named by the variable HISTFILE > (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 HIST??? > FILESIZE. When the history file is read, lines beginning with the history comment > character followed immediately by a digit are interpreted as timestamps for the preced??? > ing history line. These timestamps are optionally displayed depending on the value of > the HISTTIMEFORMAT variable. When an interactive shell exits, the last $HISTSIZE lines > are copied from the history list to $HISTFILE. If the histappend shell option is > enabled (see the description of shopt under SHELL BUILTIN COMMANDS below), the lines > are appended to the history file, otherwise the history file is overwritten. > I of course cannot be sure, but the .bash_history file contained no "slay unruh" and the bash I opened was a new one from an ssh session from my home machine. and yet "!sl" brought up that "slay unruh". > Regards, Dave Hodgins >
From: ynotssor on 19 Apr 2010 02:25 "unruh" <unruh(a)wormhole.physics.ubc.ca> wrote in message news:slrnhsn9pm.odi.unruh(a)wormhole.physics.ubc.ca... > > I am wondering where the bash history is kept-- the one which ! > selects. I know about .bash_history, but that is NOT necessarily what > the ! uses. Why do you say that? The "!" means "most recent" to that particular shell instance. Necessarily, a shell's history is kept in that process's memory and is saved to ~/.bash_history when the shell exits. That particular ~/.bash_history is not available to other concurrent shells. Each shell has its own history, initiated from the most recently saved ~/.bash_history and updated from its own command history. What would you suppose happens when the system crashes due to a non-UPS power failure when several shells are open in various windows, or remote logins exist such as ssh, rsh etc, none of which are mutually exclusive? Consult the man page for whatever shell you happen to be using to understand the details please, then attempt to understand what's stated in the context of your own unique usage. If ou can state the detailed context of your own problem then people can better assist you.
From: ynotssor on 19 Apr 2010 02:29
I wrote in message news:832bb7F2naU1(a)mid.individual.net... .... > Necessarily, a shell's history is kept in that process's memory and is saved > to ~/.bash_history when the shell exits. That particular ~/.bash_history is > not available to other concurrent shells. Correction: "That particular shell's history is not available to other concurrent shells." |