How to save the output of picocom to a file

I'm using ( sudo picocom -b 115200 /dev/ttyUSB0 ) to connect to a real-time embedded system based on ThreadX system.

Once I'm connected to this device, I use some ThreadX commands to display some logs.

Currently I'm using a manual copy past maneuver to save the logs. Is there any other way to save all the output (logs) displayed on the terminal to a file on my computer?


Solution 1:

Using tee:

picocom /dev/ttyUSB1 -b 115200 -l | tee my.log

Solution 2:

You can run it under script - see man script and do:

script my.log
sudo picocom -b 115200 /dev/ttyUSB0
...
exit

And all the inputs and outpuits will be in my.log.