Save Screen (program) output to a file

后端 未结 11 2447
长发绾君心
长发绾君心 2020-12-02 04:30

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

相关标签:
11条回答
  • 2020-12-02 05:32

    Ctrl+A then Shift+H works for me. You can view the file screenlog.0 while the program is still running.

    0 讨论(0)
  • 2020-12-02 05:35

    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.

    0 讨论(0)
  • 2020-12-02 05:35

    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".

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2020-12-02 05:37

    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
    
    0 讨论(0)
提交回复
热议问题