Why the Powerful ss Command Is Gradually Replacing netstat
Socket Search
© Lead Image ©Ioannis Kounadeas, Fotolia.com
We take a close look at the Socket Statistics utility ss and show why it is better than netstat for forensics, troubleshooting, and other networking tasks.
Anyone who has been around Linux long enough remembers when netstat [1] was the unquestioned go-to tool for checking socket activity. Whether you needed to confirm a process was listening, trace an unexpected connection, or sanity-check a server during an outage, netstat felt dependable. Because netstat was part of the Linux ecosystem for so long, most administrators stopped thinking about how it actually gathered its information. It simply worked, at least, until modern workloads exposed its age.
The core limitation of netstat comes from its reliance on parsing text inside /proc/net/. Every time the command runs, it has to read and interpret multiple pseudo-files line by line. The approach originated when Linux systems handled far fewer connections and application architectures were simpler. As long as socket tables remained small, the overhead of parsing them wasn't noticeable. But as servers began hosting thousands of short-lived connections, this design started to buckle.
When netstat parses /proc [2], it has to rebuild its view of the system from scratch each time. On a lightly loaded system, this might take only a moment. But on a busy reverse proxy, an API gateway, or a container-heavy host, those pseudo-files can grow large enough that the command feels sluggish or inconsistent. The delay is minor when measured in seconds, but during a live incident, those seconds are exactly when you need an up-to-date picture of what the network stack is doing.
[...]
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Fedora 45 Now Available
The latest iteration of Fedora has arrived with Gnome 51 and KDE Plasma 6.8.
-
Linux 7.4 is "Much Healthier" Thanks to AI
At nearly 42 million lines, Linux 7.4 is the largest merge in the kernel’s history.
-
Working Exploit for a Linux Kernel Flaw Made Public
Even before a bug received its CVE identifier or an upstream fix, the local privilege escalation vulnerability exploit found its way into the wild.
-
r/opensource Bans AI-Assisted and AI-Related Projects
The de facto subreddit for all things open source has not only banned AI-related projects but also users who "don't speak English."
-
Bottlenecks Discovered by Meta Engineers Lead to Scalability Improvements
Thanks to a small group of engineers at Meta, the Linux kernel module kernfs has been improved, which has led to some serious gains.
-
PwnEscape Poses VM Vulnerability
A guest-to-host escape flaw in Linux KVM, named PwnEscape, might be yet another means of attacking Linux.
-
Linux Mint 27 Set for a Christmas Release
The developers behind Linux Mint have announced a Christmas release, and it looks like Santa's sack will be brimming with features.
-
Is Linus Torvalds Vibe Coding?
The creator of Linux has added AI into his process for Linux kernel development, and it's more than just for debugging.
-
openKylin 3.0 Released with Expanded AI Integration
The latest release features a pre-installed AI agent to help perform tasks.
-
DigitalOcean Ends Open Source Credits Program
In a change that has surprised many open source developers, DigitalOcean has decided to sunset its Open Source Credits Program.
