How can I redirect the output of screen to a file? I'm trying to capture data from a Serial Port by opening 'screen' from the terminal. It works, I see the data coming but I can't figure out how to save it to a file.

I tried to redirect the output of screen by adding > file.txt to the command line that opens screen, something like this:

screen /dev/tty.Airconsole-1 &gt; file.txt


But it didn't work, it creates an empty file but I still see the data on the screen window.

Ideally I would like to redirect to both, I mean keep it in the window and at the same time feeding the file, probably by using the tee command.
Found possible answer at Stack Overflow:

Have you tried:

screen -L /dev/tty.Airconsole-1 &gt; file.txt