On Sat, Jul 27, 2024 at 22:50:17 +0100, mick.crane wrote:
> In debian bookworm, xfce desktop, different virtual terminals have a
> different history if same user presses "up key" in different virtual
> terminals ?

As your subject says, this is "bash history".  And yes, each instance of
bash has its own separate history.  It has nothing to do with your
terminal emulator or your desktop environment.

Bash reads its history from a file (~/.bash_history by default) at
startup time, manages it in memory while running, and writes it back
out to the history file upon exiting.

> Is this something that can be changed so history is shared between virtual
> terminals?

No.

I consider this a *good* thing, personally.  I used commerical Unix with
ksh for a very long time, and ksh shares history between instances in
real time.  This is a *nightmare*.  I really, really disliked it.

In the worst case scenario, you and a coworker might both be logged in
as root (where root's shell is ksh) simultaneously.  Your histories
would then intermix in real time.  You might press ESC k ENTER in your
terminal, expecting to re-run the command you had just executed a
moment ago, and unexpectedly run your coworker's command.

Even in a "normal" scenario where I'm logged in as myself, and nobody
else has my password, I would not want all of my terminal windows to have
a shared history.  Each of them is doing something different.  I want
each terminal's workflow to be isolated to that terminal and what I'm
doing in it.  I don't want them contaminating each other.

Of course, that's my opinion, and if you want a shared history across
concurrent shell instances, there are probably shells that can do that.
I've never looked for it, because having lived with it, I already know
I don't want it again.

Reply via email to