$linuxjunkies
>

socket unit

also: socket activation, .socket unit

A systemd unit file that defines and manages a Unix socket, allowing services to listen on sockets and handle incoming connections independently of the associated service.

A socket unit is a systemd configuration file with a .socket extension that describes a Unix domain socket, network socket, or other inter-process communication endpoint. Socket units enable socket activation, where systemd listens on the socket and only starts the associated service when a client attempts to connect.

This design decouples socket creation from service startup, improving boot performance and resource efficiency. For example, a cups.socket unit can listen for print job requests while the CUPS daemon remains inactive; systemd automatically starts the daemon when the first print job arrives.

Socket units are paired with their corresponding service units (e.g., myservice.socket works with myservice.service). They can listen on various socket types including Unix domain sockets, TCP/UDP ports, and netlink sockets. Common uses include systemd-resolved.socket, docker.socket, and sshd.socket.

Related terms