Relay Connections With socat
Bridge sockets, files, pipes and devices with one flexible command.
01Command
$ socat TCP-LISTEN:8080,fork TCP:localhost:8002What it does
socat connects two endpoints of almost any type, making it a Swiss-army knife for port forwarding, Unix-socket debugging, TLS wrapping and file transfer. The fork option keeps the listener accepting multiple connections.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Debian package: socatEvidence: Debian packages socat, a multipurpose relay that connects two data channels.
- socatEvidence: Debian packages socat, a multipurpose relay that connects two data channels.
Last verified: 2026-09-22 · Category: Network
06Related solutions
One command that prints every interface with its state and IPv4/IPv6 addresses in a short table — the modern, memorable replacement for digging through `ifconfig` or the verbose `ip addr` output.
The classic forgotten-syntax command: `traceroute` shows every router between you and a destination plus the round-trip time of probes to each hop.
Add a UFW rule to permit inbound traffic on a TCP or UDP port, such as SSH on port 22.