ss (Socket Statistics)
The ss command is a powerful utility used to investigate sockets. It is the modern replacement for the classic netstat command, providing more detailed information and running faster.
Common `ss` Commands
Display Listening Ports & Processes
ss -tlnpDisplays listening TCP ports and the processes using them.
Flag breakdown:-t→ Show only TCP connections.-l→ Show only listening ports.-n→ Do not resolve service names (faster).-p→ Show the process ID (PID) and name.
Show Active TCP Connections
ss -tnA quick way to see all established TCP connections, without waiting for name resolution.
Show Active UDP Connections
ss -unLists all active UDP connections.
Show All Sockets
ss -aDisplays all sockets (both listening and non-listening) for all protocols.
Show Unix Sockets
ss -xDisplays active Unix Domain Sockets, which are used for inter-process communication on the same machine.