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?


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
  • All I did was Ctrl+ a + : and then typed log on at the prompt. Did not need to use at \#. Anyone else confirm? – Yzmir Ramirez Jul 20 '17 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. – Stéphane Chazelas Jul 20 '17 at 18:09
  • Ctrl + a + h creates a hardcopy.0 file of the current screen. – Yzmir Ramirez Jul 26 '17 at 21:07
  • @YzmirRamirez, yes and Ctrl + a H (capital h, shift + h) toggles logging for the current Window as this answer is saying. – Stéphane Chazelas Jul 27 '17 at 6:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.