Unix bidirectional pipe on commandline

Posted by John W on Super User See other posts from Super User or by John W
Published on 2012-09-19T21:31:13Z Indexed on 2012/09/19 21:40 UTC
Read the original article Hit count: 191

Filed under:
|
|
|

I've been able to use this linux command to connect Netcat to a serial port:

nc -l 80 <> /dev/ttyS0

I would like to be able to log this transaction. My backup plan is to use Wireshark to monitor the netcat stream, but ideally I'd like to do something like this:

cat /dev/ttyS0 | tee upstream.bin | nc -l 80| tee downstream.bin | /dev/ttyS0

This tries to open ttyS0 twice and therefore throws a permissions error. Does anyone know a smarter way to do this?

© Super User or respective owner

Related posts about linux

Related posts about redirection