ss gets them from kernel space directly using Netlink which uses the classic sockets API.
ss gets them from kernel space directly using Netlink which uses the classic sockets API.
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
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?
Netstat vs ss (socket statistics) : 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.comnetstat to ss argument conversion table (link in the first comment)
netstat is obslete?
Videos
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
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