How to Check Open Ports with ss and netstat

Published 2026-08-05 · Learn Linux

To see which ports are open and what is listening on them, use ss -tulpn. It prints every TCP and UDP listener with its port and the process behind it. The older netstat command does the same job and is still found on many systems. Both answer the question: what is using port 8080?

List all listening ports with ss

The key combo is -tulpn: t for TCP, u for UDP, l for listening sockets only, p for the process name and PID (needs root for other users' processes), n for numeric ports instead of service names.

$ ss -tulpn

The same with netstat

On systems without ss, netstat uses the same flags. The output format differs slightly but the columns mean the same thing.

$ netstat -tulpn

Find what is on a specific port

Filter the output with grep to check one port. The port appears in the Local Address column, often with a suffix, so search for :8080.

$ ss -tulpn | grep :8080

Show active connections instead of listeners

Without the l flag, ss shows established connections. To watch traffic to a web server, use ss -tn and count ESTAB connections to port 80 or 443.

$ ss -tn state established

Stop the process using a port

Once ss shows the PID in the Process column, stop it with kill. A classic fix for a port already in use is kill -9 <pid>. See the ss and netstat reference pages for more options.

Keep learning

Related guides: How to Use the ssh Command to Connect to a Remote Server · How to Kill a Process in Linux with the kill Command · How to Monitor Processes with ps and top. Read all tutorials on the Learn Linux blog.