On 2024-07-27 at 18:44, mick.crane wrote: > On 2024-07-27 23:08, Greg Wooledge wrote: > >> 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. > > Where is it if not in ~/.bash_history?
In memory. >> 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. As Greg wrote: bash reads it in at startup time, then manages it in memory, then writes it back out when exiting. Unless you've configured it otherwise, the place it reads the history in from and writes it out to is ~/.bash_history. In between those, each and every separate instance of the shell keeps the history in memory. Yes, if I'm not mistaken that *does* mean that if you have 20 terminals open you have 20 copies of (some version of) the history in memory. > Does this separate history get written to ~/.bash_history when > terminal emulation thing is closed? That depends on how you have things configured. It's not really "separate", however; it's just that history is only written out when bash exits (sufficiently cleanly), and that's just as true when you have multiple instances of bash as when you have only one. -- The Wanderer The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man. -- George Bernard Shaw
signature.asc
Description: OpenPGP digital signature