How to Check Open Ports on Linux Server
Check listening ports and identify which services are running on your Linux server.
Before you start
Step-by-step instructions
1. Check listening ports with ss
The ss command is the most common modern way to see listening ports on Linux.
ss -tuln
This command displays TCP and UDP ports that are currently listening, without resolving service names.
2. Use netstat if it is available
Some older systems still use netstat to check open ports.
netstat -tuln
If netstat is missing, use ss instead. Many newer Linux distributions no longer install net-tools by default.
3. Check which process is using a port
Use lsof when you need to know which process is bound to a specific port.
lsof -i :80
This is useful when you want to confirm whether Apache, Nginx, MySQL, or another service is actually listening on the expected port.
Common issues
The service may not be running, may have failed to start, or may be bound only to a local interface.
In that case, check firewall settings, cloud security rules, and whether the service is listening on the correct IP address.
If netstat or lsof is missing, install the required package or use an alternative command that already exists on the server.
Final check
Use ss or netstat to confirm which ports are listening, then use lsof to verify which process owns the port. If the service is listening but still unreachable, move on to firewall and network checks.
About this guide
This guide explains how to check open ports on a Linux server using common command line tools such as ss, netstat, and lsof.
How to follow this guide
- Use ss to list listening ports.
- Use netstat if it is available on the server.
- Use lsof to see which process is using a port.
- Confirm whether the expected service is actually listening.
Why use this method?
Checking open ports helps you verify whether services are running correctly and whether the server is listening on the expected ports.
Frequently Asked Questions
What does ss do?
ss shows socket and listening port information on Linux systems.
What if netstat is not installed?
Many newer Linux systems use ss instead of netstat by default.
Why use lsof?
lsof helps identify which specific process is using a port.
Does checking open ports confirm firewall access too?
No. It only confirms whether the local service is listening. Firewall rules may still block access.