I need to save the whole output of Screen to a file to check later all the content.
The reason is that I\'m dumping a flash memory through a serial port, using Scree
Ctrl+A then Shift+H works for me. You can view the file screenlog.0
while the program is still running.
There is a command line option for logging. The output is saved to screenlog.n file, where n is a number of the screen. From man pages of screen:
‘-L’ Tell screen to turn on automatic output logging for the windows.
You can also use Control-a + H to save loggings into screenlog.n file. One more Control-a + H to turn off.
C-a H: Begins/ends logging of the current window to the file "screenlog.n".
Here's a trick: wrap it in sh -c
!
screen sh -c './some-script 2>&1 | tee mylog.log'
Where 2>&1
redirects stderr to stdout so tee
can catch and log error messages.
The following might be useful (tested on: Linux/Ubuntu 12.04 (Precise Pangolin)):
cat /dev/ttyUSB0
Using the above, you can then do all the re-directions that you need. For example, to dump output to your console while saving to your file, you'd do:
cat /dev/ttyUSB0 | tee console.log