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 trough serial port, using screen to interface with it.
I would like to save it to a file to check memory structure.
I've tried :
$: screen /dev/ttyUSB0 115200 >> foo.txt
$: screen /dev/ttyUSB0 115200 | tee foo.txt
and I've also tried to use bufferfile from screen, but I don't understand how to use it.
Is there an easy way?
for mac terminal:
details
script
built in app to "make a typescript of terminal session"-a
append to output file-t 0
time between writing to output file is 0 seconds, so out.txt is updated for every new charout.txt
is just the output file namescreen /dev/ttyUSB0 115200
- command from question for connecting to external deviceyou can then use tail to see that the file is updating
The selected answer doesn't work quite well with multiple sessions and doesn't allows to specify a custom log file name.
For multiple screen sessions, this is my formula:
1) create a config file for each process:
If you want to do it "on the fly", you can change
logfile
automatically.\012
means "new line", as using\n
will print it on the log file: source.2) Start your command with the "-c" and "-L" flags:
That's it. You will see "test.log" after the first flush:
I found that "-L" is still required even when "log on" is on the config file.
I couldn't find a list of the time format variables (like %m) used by screen. If you have a link of those formats, please post it bellow.
** EXTRA **
In case you want to do it "on the fly", you can use this script:
To use it, save it (screen.sh) and set +x permissions:
... and will execute ./test.pl and create a log file in /var/log/TEST.log
The following might be useful (Tested on: Linux/Ubuntu 12.04):
Using the above, you can then do all the re-directions that you need. For example, to dump output to your console whilst saving to your file, you'd do: