Stop guessing which socket is hogging your ephemeral ports
Networking & Firewall (Ss/Netstat/Iptables/Nftables/Curl)
Stop guessing which socket is hogging your ephemeral ports
🧩 The Challenge
Dealing with a service that suddenly refuses to open new connections because you’ve run out of source ports is the worst kind of panic. You know the connections exist, but scrolling through thousands of lines of netstat output is a waste of a perfectly good afternoon.
💡 The Fix
Use ss with a filter to display exactly what you need without dumping the entire kernel state to your screen. It saves you from parsing a massive wall of text just to find a handful of hung connections.
ss -tanp '( sport = :80 or sport = :443 )' state established
⚙️ Why It Works
By passing a filter expression directly to the socket statistics utility, the kernel does the heavy lifting before the data even hits your terminal buffer. It makes finding specific traffic patterns on busy web servers immediate instead of a guessing game.
🚀 Pro-Tip: Add the -u flag if you suspect your UDP services are leaking sockets too.
Linux Tips & Tricks | © ngelinux.com | 7/14/2026
