/ Published in: Bash

Filters for tcp and tcp6 lines, so omits udp and unix sockets.
Information is gathered from /proc; this uses netstat mainly to format it.
Gives output like:<pre> 21 tcp LISTEN
12 tcp ESTABLISHED
7 tcp6 LISTEN
1 tcp TIME_WAIT</pre>
Information is gathered from /proc; this uses netstat mainly to format it.
Gives output like:<pre> 21 tcp LISTEN
12 tcp ESTABLISHED
7 tcp6 LISTEN
1 tcp TIME_WAIT</pre>
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
netstat -nal |egrep '^tcp' | sed -r 's/[ ]+/ /g' | cut -d ' ' -f 1,6 | sort | uniq -c | sort -rn
Comments
