brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: ss -x lists the Unix sockets that never show up as a port on Linux

Linux
~/tips/tip-linux-ss-x-unix-sockets

ss -xlp

Find which process listens on a local socket file, like the Docker or database socket.

Plenty of services talk over a socket file instead of a TCP port: Docker, MariaDB, PHP-FPM, systemd itself. ss -tulpn will never show them, because they are not TCP or UDP.

The -x option switches ss to Unix domain sockets. Add -l for the listening ones and -p for the process behind each of them:

ss -xlp

The Local Address column then holds a path, for example /run/docker.sock or /run/mysqld/mysqld.sock, with the program name and PID next to it. When an app says it cannot connect to its database socket, this is the first thing I’d run: either the path is there and something listens, or it is not.

You can filter on the path, which keeps the list short on a busy machine:

ss -xlp src /run/php/*

Without -l you see the connected sockets too, and a desktop or a systemd host has hundreds of those, mostly unnamed. That list is noisy and rarely what you want.

Run it with sudo if the process column stays empty. As a normal user, ss can only name processes that belong to you, so a socket owned by root or by a service account shows up without its owner.

Further reading: ss(8) manual page, unix(7) manual page

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt All Linux tips (261) All topics

Link