Showing results for netstat vs ss
Search instead for netstat v s ss

ss gets them from kernel space directly using Netlink which uses the classic sockets API.

Answer from ggiroux on Stack Overflow
🌐
Reddit
reddit.com › r/commandline › netstat vs ss (socket statistics)
r/commandline on Reddit: Netstat vs ss (socket statistics)
August 18, 2023 -

The manual for Netstat says it's obsolete and that I should use ss instead, but I like Netstat's more compact and easy-to-read interface better than ss's wide and spread-out display.

Is there anything wrong with Netstat compared to ss? Which one do you use?

Top answer
1 of 2
10
manual for Netstat says it's obsolete and that I should use ss instead Yup, true that. anything wrong with Netstat compared to ss Oh hell yeah. ss is far superior. E.g. let's say you want to know what PID(s) are associated with what (if anything) is listening on TCP port 22: # ss -nltp sport = :22 State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=852,fd=3)) LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=852,fd=4)) # That's highly fast and efficient, as the filtering happens in kernel. Now, compare that to wanting to do same with netstat - you'd need to run a netstat command that gets a lot more information than just for TCP port 22 - that alone can be exceedingly slow on a heavily loaded system - possibly taking minutes or more to return results - whereas even under comparable load that ss command will be much faster and probably complete in mere seconds or less. But with the netstat command to get just port 22 TCP results, then you'll need to filter it with grep or awk or sed or the like - and if you don't get it exactly right (more complex) you may get false positives - e.g. other stuff that matches, say string :22 other than only and exactly in the relevant field/position. ss is much more versatile than just that example, but that's just one example of how one can very quickly and efficiently get precisely the needed information from ss. Very similar in efficiency (and ease of correct accuracy) in filtering, e.g. by IPs, protocol(s), state, etc., and also many options to control output formatting, etc. Also, for non-ancient *nix operating systems, ss will generally be included / installed by default, whereas netstat may not be.
2 of 2
2
If you are using ss, use it with a pager like more or less. Running it by itself is a mess for readability.
Discussions

Netstat vs ss (socket statistics) : r/commandline
🌐 r/commandline
Netstat vs ss (statistiche socket)

Il manuale di Netstat dice che è obsoleto e che dovrei usare ss invece

Già, è vero.

C'è qualcosa di sbagliato in Netstat rispetto a ss

Oh, sì. ss è di gran lunga superiore.

Ad esempio, diciamo che vuoi sapere quale PID(s) è associato a ciò che (se presente) è in ascolto sulla porta TCP 22:

# ss -nltp sport = :22
State  Recv-Q Send-Q Local Address:Port Peer Address:PortProcess                       
LISTEN 0      128          0.0.0.0:22        0.0.0.0:*    users:(("sshd",pid=852,fd=3))
LISTEN 0      128             [::]:22           [::]:*    users:(("sshd",pid=852,fd=4))
# 

Questo è molto veloce ed efficiente, poiché il filtraggio avviene nel kernel. Ora, confronta questo con il voler fare lo stesso con netstat: dovresti eseguire un comando netstat che ottiene molte più informazioni rispetto a quelle solo per la porta TCP 22 - questo da solo può essere estremamente lento su un sistema pesantemente caricato - potenzialmente impiegando minuti o più per restituire i risultati - mentre anche sotto un carico comparabile quel comando ss sarà molto più veloce e probabilmente si completerà in pochi secondi o meno. Ma con il comando netstat per ottenere solo i risultati TCP della porta 22, dovrai filtrarlo con grep o awk o sed o simili - e se non lo ottieni esattamente giusto (più complesso) potresti ottenere falsi positivi - ad esempio, altre cose che corrispondono, diciamo la stringa :22 diversa da solo ed esattamente nel campo/posizione rilevante. ss è molto più versatile di quel semplice esempio, ma questo è solo un esempio di come si possono ottenere rapidamente ed efficientemente le informazioni necessarie da ss. Molto simile in efficienza (e facilità di accuratezza corretta) nel filtraggio, ad esempio, per IP, protocollo(i), stato, ecc., e anche molte opzioni per controllare la formattazione dell'output, ecc.

Inoltre, per i sistemi operativi *nix non antichi, ss sarà generalmente incluso/installato di default, mentre netstat potrebbe non esserlo.

More on reddit.com
🌐 r/commandline
4
8
August 18, 2023
netstat to ss argument conversion table (link in the first comment)
ss -tulpn Everything you need in a normal admin day More on reddit.com
🌐 r/linux
32
517
May 19, 2020
netstat is obslete?
The netstat(8) man page https://net-tools.sourceforge.io/man/netstat.8.html says This program is obsolete. Replacement for netstat is ss. Replacement for netstat -r is ip route. Replacement for netstat -i is ip -s link. Replacement for netstat -g is ip maddr. More on reddit.com
🌐 r/linux4noobs
13
4
January 27, 2024
🌐
ComputingForGeeks
computingforgeeks.com › home › netstat vs ss usage guide on linux
netstat vs ss usage guide on Linux [2026]
August 5, 2024 - Netstat is a command-line network ... tables, masquerade connections, multicast memberships e.t.c. netstat program is obsolete and its replacement is ss....
🌐
Medium
medium.com › itversity › understanding-socket-connections-with-netstat-and-ss-00cde8e9454c
Understanding Socket Connections with netstat and ss | by Chaitanya Varma Manthena | itversity | Medium
November 6, 2024 - For example, if you notice a large ... (Denial of Service) attack or experiencing a connection flood. ss (Socket Statistics) is a modern replacement for netstat, designed to be faster and more efficient, especially on large systems ...
🌐
Linux Foundation
training.linuxfoundation.org › home › tutorials › an introduction to the ss command
An Introduction to the ss Command - Linux Foundation - Education
November 22, 2023 - The ss command is a tool used to dump socket statistics and displays information in similar fashion (although simpler and faster) to netstat. The ss command can also display even more TCP and state information than most other tools.
🌐
WafaiCloud Blogs
wafaicloud.com › blog › exploring-network-connections-with-netstat-and-ss-in-linux
Exploring Network Connections with Netstat and SS in Linux – WafaiCloud Blogs
June 30, 2025 - Foreign Address: The address and port number of the remote machine. State: The state of the connection (e.g., LISTEN, ESTABLISHED). The ss (socket statistics) command is a modern replacement for netstat.
Top answer
1 of 2
4

I've made a comparison table (in Google Docs) (light HTML link) for converting between netstat and ss arguments. It's too big to include and update it here.

The short version of difference between short arguments is:

Arguments that require attention: r N i g M W T v C F c A U 2 f

Arguments that are safe to leave as is: h V l a n Z s p e o 4 6 x t u S w

2 of 2
0

I stumbled across this post while researching netstat -> ss conversion. Outstanding table but I wanted to point out one thing in particular... the man page description for the netstat -s command option states, "Display summary statistics for each protocol". ss -s option in the man page states, "Print summary statistics. This option does not parse socket lists obtaining summary from various sources. It is useful when amount of sockets is so huge that parsing /proc/net/tcp is painful." These two command options return EXTIRELY different information.

For example:

$ ss -s
Total: 1365 (kernel 0)
TCP:   276 (estab 163, closed 14, orphaned 0, synrecv 0, timewait 1/0), ports 0

Transport Total     IP        IPv6
*         0         -         -
RAW       1         1         0
UDP       24        17        7
TCP       262       246       16
INET      287       264       23
FRAG      0         0         0

as opposed to the netstat -s command output (truncated):

$ netstat -s | head -n15
Ip:
    2043673568 total packets received
    0 forwarded
    0 incoming packets discarded
    1997519606 incoming packets delivered
    1359233819 requests sent out
    53 dropped because of missing route
    22 reassemblies required
    11 packets reassembled ok
Icmp:
    38023 ICMP messages received
    7619 input ICMP message failed.
    ICMP input histogram:
        destination unreachable: 23947
        timeout in transit: 129

I don't know if the upstream developers of ss intend on expanding the available output from the command, but near as I can tell... ss doesn't offer anything equivalent to the netstat -s statistics.

/ SenseiC bows out

Find elsewhere
🌐
TecAdmin
tecadmin.net › comparison-between-ss-vs-netstat-commands
A Comparison Between ss vs netstat Commands – TecAdmin
April 26, 2025 - Both the ss and netstat commands have their own strengths and weaknesses. ss is faster and provides more detailed information, making it the preferred choice for network analysis and troubleshooting in Linux.
🌐
InterServer
interserver.net › home › linux › how to use netstat and ss to monitor network connections and ports
How to Use netstat and ss to Monitor Network Connections and Ports - Interserver Tips
April 23, 2026 - Mastering netstat and ss gives you powerful visibility into your Linux system’s network activity. While netstat remains familiar, ss is the tool of choice for speed and advanced filtering. Both utilities help you pinpoint open ports, investigate suspicious connections, troubleshoot network ...
🌐
Damonsec
damonsec.com › blog › netstat-vs-ss-command
netstat vs ss: Which to Use and What's the Difference | damonsec.com
April 22, 2026 - Both show network connections and listening ports. ss is faster, more accurate, and pre-installed on all modern Linux. netstat is older, often missing, and deprecated — but still widely known and occasionally the only option.
🌐
ServerAvatar
serveravatar.com › home › blog › how to use netstat, ss, and lsof for linux network debugging
How to Use netstat, ss, and lsof for Linux Network Debugging
November 14, 2025 - Overlooking automation, manual debugging takes time. netstat shows general network statistics, ss provides faster and more detailed socket information, and lsof lists open files and the processes using them.
🌐
Red Hat
redhat.com › en › blog › ss-command
Linux tools: How to use the ss command
November 20, 2025 - Formally, ss is the socket statistics command that replaces netstat. In this article, I provide netstat commands and their ss replacements.
🌐
OneUptime
oneuptime.com › home › blog › how to use ss as a replacement for netstat to view ipv4 sockets
How to Use ss as a Replacement for netstat to View IPv4 Sockets
March 20, 2026 - ss (socket statistics) is the modern replacement for the deprecated netstat. It queries the kernel's socket information directly and is significantly faster than netstat on systems with many connections.
🌐
DEV Community
dev.to › vivian-voss › netstat-vs-ss-5a1p
netstat vs ss - DEV Community
May 11, 2026 - The wrong thing is not the tool's parsing; it is being asked to do that parsing because the thing in front of it was a file rather than a queryable interface. The replacement is ss(8), short for socket statistics.
🌐
Net7
net7.be › blog › article › network_activity_analysis_1_netstat.html
Net7 - Blog - Analysing network activity #1 - netstat, ss and lsof
March 29, 2021 - On Windows the feature to have ... every 1 second. The ss command shows socket information, pretty much like netstat does, with the key difference that it doesn't read /proc/net/* special files and uses a "newer" (it's actually very old) kernel API instead....
🌐
Command Line
commandinline.com › home › linux › ss vs netstat in linux: modern socket diagnostics
ss vs netstat in Linux: Modern Socket Diagnostics | Command in Line
January 1, 2026 - The netstat command was deprecated in 2001 and removed from default installs on many distributions. Its replacement, ss, is faster, queries the kernel directly through NETLINK, and supports more features.
🌐
phoenixNAP
phoenixnap.com › home › kb › sysadmin › how to use linux ss command
How To Use Linux SS Command
January 27, 2025 - The ss (socket statistics) tool is a CLI command used to show network statistics. The ss command is a simpler and faster version of the now obsolete netstat command.
🌐
Yogaraj.S
syogaraj.github.io › blog › netstat-ss-output-comparison.html
Understanding TCP Listen Sockets: Netstat vs. ss | Yogaraj.S
February 21, 2025 - The main difference between netstat and ss is that, ss uses netlink to list the details which makes it efficient and performant when compared to netstat.
🌐
Linux Audit
linux-audit.com › linux audit › alternative for netstat: ss tool
Alternative for netstat: ss tool - Linux Audit
March 12, 2025 - Socket statistics, or ss for short, is an easy replacement command for netstat.