In short: The most practical way to check open ports on Linux is the command ss -tulpn. It lists the TCP and UDP ports your server is listening on and the process that opened each one. If the local address is 127.0.0.1, the port is reachable only from the server itself; 0.0.0.0 means it listens on all network interfaces.
Connect to your server over SSH (see our SSH guide) and run:
ss -tulpn
To see the process names of other users, you usually need sudo ss -tulpn. According to the ss help output, the options mean:
-t: show TCP sockets.-u: show UDP sockets.-l: show only listening sockets.-p: show the process using the socket.-n: do not resolve service or host names; print port numbers.For every option, see the ss manual page.
The output has these columns: Netid (tcp or udp), State (LISTEN for a listening socket), Recv-Q and Send-Q (queue values), Local Address:Port (the address and port the server listens on), Peer Address:Port (usually 0.0.0.0:* for a listening socket) and Process (process name, pid and file descriptor). The process column looks like users:(("python3",pid=3031,fd=5)).
This difference matters for security. For example, when a test server is started on 127.0.0.1, the output looks like this:
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 5 127.0.0.1:18080 0.0.0.0:*
127.0.0.1 means the service can be reached only from inside the server; nobody can connect from the internet. If the same service listened on 0.0.0.0, it would accept connections on all IPv4 interfaces. For IPv6, the output shows * or [::] in the same role. If a service that should not be exposed, such as a database, listens on 0.0.0.0, review its configuration or your firewall rules.
ss -tlnp 'sport = :80'
ss -4tln
ss -6tln
ss -s
'sport = :80': filters sockets whose source (local) port is 80. Empty output means nothing is listening on that port.-4 and -6: list only IPv4 or only IPv6 sockets.-s: print summary counts of sockets.Ports you often meet in the output are 22 (SSH), 80 (HTTP), 443 (HTTPS) and 3306 (MySQL and MariaDB). Official port assignments are kept in the IANA service name and port number registry. If you do not recognise a number, look it up there first and then match it with the process name in the Process column. Another program can use the same number, so trust the process rather than the number alone.
127.0.0.1 in its configuration.Remember that ss shows only what the server listens on. Whether a port is reachable from the internet also depends on the firewall. For general security steps on a new server, read our Linux server hardening article.
Both list network sockets. ss comes with the iproute2 package and is available by default on current Linux distributions; this guide shows the commands with ss.
The process column needs the -p option. To see processes that belong to other users you usually have to run the command with sudo.
ss only shows that the server listens on the port. A firewall, cloud provider rules or a listen address of 127.0.0.1 can block outside access.
Use a filter such as sudo ss -tlnp 'sport = :80'; the Process column shows the name and pid of the process that opened it.