Troubleshooting Socket States with ss
Networking & Firewall (Ss/Netstat/Iptables/Nftables/Curl)
Troubleshooting Socket States with ss
🧩 The Challenge
You need to quickly identify which processes are hogging local ports or holding onto stale TCP connections without wading through verbose netstat output.
💡 The Fix
Use the ss utility to filter specifically for active TCP sockets while displaying the associated process ID and user information.
ss -tpn
⚙️ Why It Works
The -t flag filters for TCP sockets, -p shows the process using the socket, -n resolves addresses numerically to avoid slow DNS lookups, and the output is significantly faster and more concise than the legacy netstat command.
🚀 Pro-Tip: Append the state filter ‘state established’ to the command to ignore listening ports and focus strictly on active, data-transferring connections.
Linux Tips & Tricks | © ngelinux.com | 7/5/2026
