I use GNU screen mostly to run commands that become non-interactive after some initial input.
I do not like navigating output in screen sessions, I feel it is a bit buggy.
Is there a way to access the history of a screen session without screen -r
? (Not sure about the correct terminology here, I simply mean all the input and output that has occured in the screen session, not the history in the sense of the commands that were entered in the shell prompt).
Ideally, I'd like to do this with (1) bash/Linux builtins, (2) else with screen
itself, (3) else with a Python package, (4) and only if none of these are possible with an external program.
(1: e.g. cat /run/screen/S-user/12345.pts-1.pc
2: e.g. screen --cat 12345
3: e.g. pip install screen; python -c 'import screen;print(screen.read_socket("12345"))'
4: e.g.sudo apt install screenreader; screenreader 12345
)
screen -L
or settinglog on
, default file is./screenlog.%n
where%n
is the window number. – meuh Aug 25 '18 at 17:56~/.screenrc
) to something including magic characters like%S
and it will be replaced by the session name,%t
for the window title etc. You can even use the time and date. If you place them in/tmp/
most distributions these days will remove them after a few days (or when you reboot), or you can write your own cron job. – meuh Aug 25 '18 at 21:20screen -ls
: I am now usingLogfile ./%p.%S
– Bananach Aug 26 '18 at 6:28