How to see the number of open connections on Linux
How to see the number of open connections?
Run the ss command and use the '--summary' option see statistics, such as the number of open network connections.
ss --summaryThe ss command is probably the best tool to query statistics for network connections, including the total number of open connections.
Show active connections
With --summary the active state can be shown, including established TCP connections.
# ss --summary
Total: 225
TCP: 26 (estab 10, closed 10, orphaned 0, timewait 10)
Transport Total IP IPv6
RAW 1 0 1
UDP 3 2 1
TCP 16 14 2
INET 20 16 4
FRAG 0 0 0
This output is slim, but provides a first good insight on how busy the system is when it comes to network connectivity. Great for troubleshooting servers like a web server.
Want to see active ongoing connections and monitor them? Consider using the iftop command.