Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
socat examples

Effectively tail a file and serve it up via a browser:

socat -T0.05 -u FILE:/var/log/syslog,ignoreeof TCP4-LISTEN:12345,fork,reuseaddr

Simple file server

socat TCP-LISTEN:8080,reuseaddr,fork,crlf SYSTEM:"echo HTTP/1.0 200; echo Content-Type\: text/plain; echo Connection\: close; echo; cat /Users/rockymadden/.socat"

Mirror filesystem:


dd if=/dev/sdb1 | socat - openssl:sinkhost:9999


socat openssl-listen:9999 | dd of=/dev/sdc1

pg_dump without touching disk to another server:


pg_dump -C dbname | bzip2 | socat - openssl:sink:8443


socat openssl-listen:8443 > dbname.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.