I am running a detached screen
session, and running a command into it with screen -X
, like so:
screen -S $SESSION -X <command>
This works fine, though I would like to be able to catch the output of the command without entering the screen. Is there some way to, from the command line, dump the history?
As a workaround, I tried to turn on the log for the session by doing
screen -L -S $SESSION -X <command>
but it does not seem to create a log file.
So, in summary, is it possible to dump the screen history for a running detached screen session or is it possible to turn on and off logging for a running detached session?
Best Answer
To start a screen with logging enabled, use
To enable logging on an existing screen
you might want to specify which screen if you have multiple running using -S
The log will contain everything the screen sends to stdout from when logging was enabled. You may want to remove screenlog.X and re-enable logging to get the most recent output.