I have a socket server which creates unix socket and then reads data from this unix socket. Then I have another long-process application and I want to redirect stdout of this process to my unix socket. I tried this command to test
ping 127.0.0.1 > /tmp/unixsockettest.sock
But I get -bash: /tmp/unixsockettest.sock: No such device or address. Is it possible to redirect application output to unix socket?
You can't redirect out to a Unix socket using shell i/o redirection, but you can use a tool like socat (which is probably packaged for your distribution) to accomplish the task:
ping 127.0.0.1 | socat - unix-connect:/tmp/unixsockettest.sock
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With