Guides

Step-by-step tutorials and practical fixes for servers, systems, and daily technical work.
Linux Guides

How to Check Open Ports on Linux Server

Check listening ports and identify which services are running on your Linux server.

Before you start

You need terminal access to the Linux server.
Some commands may require sudo privileges.
Different Linux systems may have different tools installed.

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.

Command
ss -tuln
What it shows

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.

Command
netstat -tuln
Tip

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.

Command
lsof -i :80
Example use

This is useful when you want to confirm whether Apache, Nginx, MySQL, or another service is actually listening on the expected port.

Common issues

No listening port appears

The service may not be running, may have failed to start, or may be bound only to a local interface.

Port is listening but connection still fails

In that case, check firewall settings, cloud security rules, and whether the service is listening on the correct IP address.

Tool is not installed

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

  1. Use ss to list listening ports.
  2. Use netstat if it is available on the server.
  3. Use lsof to see which process is using a port.
  4. 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.