ss command in Linux: sockets and listening ports
Updated July 3, 2026
The ss command shows network sockets: listening ports and open connections.
Syntax
ss [options]Common cases
ss -tuln # listening TCP and UDP ports, numeric
ss -tp # open TCP connections with processes
ss -s # socket summary
ss -tln | grep :22 # is anything listening on port 22How it works: what the flags mean
The
ssflags build up from letters:-tis TCP,-uis UDP,-lis listening only,-nkeeps port numbers numeric (faster and clearer than names),-pshows the process holding the socket (often needs root).ssreplacednetstatand reads socket data straight from the kernel, so it is faster. A socket in the LISTEN state is a server waiting for connections on its port.
Used in
You need this in the lesson Networking: inspection. The theory is the chapter Networking basics.
See also
Try it
Open the sandbox: a real throwaway Linux terminal in your browser. Run the commands above by hand - the container is deleted when you leave.