« Back to Networking: Frequently Asked Questions

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 --summary

The 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.

Relevant commands in this article

Like to learn more about the commands that were used in this article? Have a look, for some there is also a cheat sheet available.

Other questions related to Networking

    Related articles

    Like to learn more? Here is a list of articles within the same category or having similar tags.

    Feedback

    Small picture of Michael Boelen

    This article has been written by our Linux security expert Michael Boelen. With focus on creating high-quality articles and relevant examples, he wants to improve the field of Linux security. No more web full of copy-pasted blog posts.

    Discovered outdated information or have a question? Share your thoughts. Thanks for your contribution!

    Mastodon icon