Piccoli seguito del mio articolo precedente su iproute2, in questo articolo vedremo alcuni utilizzi del comando ss per conoscere maggiori informazioni sui Socket TCP/UDP e non solo.
Il comando ss è incluso nel pacchetto iproute2 ed è il sostituto del comando netstat.
ss è utilizzato per eseguire il dump delle statistiche dei socket. Mostra informazioni simili a netstat. E ‘ possibile visualizzare più informazioni TCP e di stato dei socket di molti altri strumenti.
Le opzioni più comuni del comando ss sono (dal man):
-n, --numeric
Do now try to resolve service names.
-r, --resolve
Try to resolve numeric address/ports.
-a, --all
Display all sockets.
-l, --listening
Display listening sockets.
-o, --options
Show timer information.
-e, --extended
Show detailed socket information
-m, --memory
Show socket memory usage.
-p, --processes
Show process using socket.
-i, --info
Show internal TCP information.
-s, --summary
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.
Ed adesso alcuni utilizzi pratici di ss:
1) ss -l
Mostra tutte le porte in stato listening.
2) ss -o state established '( dport = :ssh or sport = :ssh )'
Mostra tutte le connessioni stabilite con porta sorgente o destinazione quella di ssh (22)
3) ss -ant | awk '{print $NF}' | grep -v '[a-z]' | sort | uniq -c
Mostra il numero ed il tipo delle connessioni attualmente attive.
4) ss -x src /tmp/.X11-unix/*
Mostra tutti i processi locali collegati ad un server X
5) ss -s
Stampa un sommaria riassuntivo sullo stato dei socket.
6) ss -tlnp
Mostra tutte le porte in ascolto ed il PID del processo associato.
Il PID sarà mostrato solo se siete root o utenza equivalente.
Per maggiori informazioni vedere la pagina ufficiale
Popular Posts:
- None Found

Very nice article, helped me a lot
[…] Tout le monde connait netstat… mais connaissez vous la commande “ss” ? Elle fait partie de iproute2 et offre des fonctionnalités similaires. […]
Thanks a lot for your help. Anyway I needed the removal of netstat from new RHEL distribution as I needed a hole in my brain. Major productivity loss.