20

Suppose I have an attached screen, but I forgot to execute screen -L initially. Is it possible to enable and disable the logging of the currently attached screen without re-executing screen?

I know that it's possible to take what is essentially a screenshot of a currently attached screen by pressing Ctrl+a h (that key combo followed by h), but I want to enable persistent logging of the attached screen. Is it possible?

1 Answer 1

28

To enable logging on the current window of a screen session, press Ctrl+AH (uppercase H, Shift+H if you prefer).

That actually toggles the logging state (so if the windows was being logged beforehand, it is now no longer logged).

That's the log command in screen, so you can also do Ctrl+A: and enter log (or log on to turn it on instead of toggling the state), or run screen -X log on within the shell running in the current window.

To enable logging on all windows, use the at command to apply that to all windows:

screen -X at '#' log on

Or press, Ctrl+A: and enter at \# log on.

For more details, see:

info -f screen --index-search=at
info -f screen --index-search=log
4
  • All I did was Ctrl+ a + : and then typed log on at the prompt. Did not need to use at \#. Anyone else confirm? Commented Jul 20, 2017 at 17:33
  • @YzmirRamirez, log on is just the equivalent of ^A H, it only logs the current window. You need at # log on to do that for every window. Commented Jul 20, 2017 at 18:09
  • Ctrl + a + h creates a hardcopy.0 file of the current screen. Commented Jul 26, 2017 at 21:07
  • @YzmirRamirez, yes and Ctrl + a H (capital h, shift + h) toggles logging for the current Window as this answer is saying. Commented Jul 27, 2017 at 6:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .