Here's a snip from my .bashrc that gives me per-window history in screen: # window-specific history histbase="$HOME/.local/bash/history" mkdir -p "$histbase"
if [ -n "$WINDOW" ]; then export HISTFILE="$histbase/history.$WINDOW" else export HISTFILE="$histbase/history" fi unset histbase Screen sets the "WINDOW" environment variable to the *initial* number of the screen window: if you start a screen as window 3, and then renumber it to 7, "$WINDOW" stays "3". This works well for my use of screen, where I have a .screenrc that sets up screens 0, 1, 2, 7, 8, and 9 with titles and environments (working directory, etc) for designated purposes, such that it's nice that window 7 also comes up with the same bash history from the last time I shut down screen, not mixed with commands from windows 1, 2, 8, or 9. Ed On Mon, Nov 08, 2021 at 10:53:28PM -0500, Roger wrote: > I have frequently noticed GNU Screen with multiple Bash shells, each > shell/tab, > the history is routinely forgotten/lost. > > A possible solution is to increase Bash history command and file size: > > Here I increased from 150 to 15,000(lines/MB) > > export HISTSIZE=15000 > export HISTFILESIZE=15000 > > Sort of ridiculous, and I think the cause is more related to not safely > exiting each shell/tab prior to halt. > > Maybe the proper method to halt a system is to send a signal to GNU Screen, > and place it within a halt.sh script? > > Roger > > > On Sun, Nov 07, 2021 at 06:20:08PM +0400, Vishal Priyatham wrote: > > Thanks Robin for the reply.� > > looks like we lost the history then as the screen session killed > > now.� � > > Regards, > > Vishal > > > > On Sun, Nov 7, 2021 at 10:28 AM Robin Lee Powell > > <robinleepow...@gmail.com> wrote: > > > > Well, the normal shell history stuff. > > As far as screen goes, you can dump the scrollback and search for > > your shell prompt, but that's about it. > > On Sun, Nov 07, 2021 at 09:29:12AM +0400, Vishal Priyatham wrote: > > > Hi team, > > > > > > We are using screen utility on linux server for one of our > > projects. > > > We have some issue related to our application and wanted to check > > what were > > > some of the commands run in the past which caused the issue. > > > Is there a way to know the commands run inside the screen session? > > > > > > > > > Regards, > > > Vishal -- Ed Blackman
signature.asc
Description: PGP signature