« Back to Networking: Frequently Asked Questions

How to see open ports on Linux

The ss command is a great utility on Linux to see socket statistics, including opened network ports. As the tool has many options, it may not be very obvious at first what options to use. In this article we look at showing all available TCP/UDP ports that are in a listening state (TCP) or are opened (UDP) for incoming connections.

ss -plunt

So what does this command do?

OptionAction performed
-lState should be ’listening’ (TCP)
-nNumeric display, do not map service names (e.g. show 22 instead of ssh)
-pInclude the process that opened the port
-tShow TCP ports
-uShow UDP port

Want to see a little bit more information, including established connections? Consider using the easy to remember -plants option. Besides the established connections, it will also display a small summary at the top about the used network protocols and their state.

Learn more about ss

This article uses the ss command to achieve its tasks. For this popular tool there is a cheat sheet available!

» Mastering the tool: ss

ss cheat sheet

Other questions related to Networking

Feedback

Is the described answer not working or incorrect, got another tip or question? Share your thoughts!