Relay Connections With socat

Bridge sockets, files, pipes and devices with one flexible command.

LinuxnetworksocketstcpLow risk
Run socat TCP-LISTEN:8080,fork TCP:localhost:80 to forward a local port.

01Command

Command
$ socat TCP-LISTEN:8080,fork TCP:localhost:80

02What 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

RiskLow risk
Requirementssudo apt install socat
!Warning: A listening relay is reachable by others and can expose an internal service; bind to 127.0.0.1 and restrict access when testing.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Debian package: socat
    Debian · vendor-doc · 2026-09-20
    Evidence: Debian packages socat, a multipurpose relay that connects two data channels.
  • socat
    Official project · vendor-doc · 2026-09-20
    Evidence: Debian packages socat, a multipurpose relay that connects two data channels.

Last verified: 2026-09-22 · Category: Network

06Related solutions