linux log serial to binary file

Shell
(stty raw; cat > received.log) < /dev/<your_serial_port>

Source

Also in Shell: