Check open ports on Linux

A practical checklist for finding which ports are open on a Linux machine or across your network, from local sockets to a full nmap scan.

LinuxProcessesnetworkprocessmonitoringportsnetstatMedium risk
Run `sudo ss -tulpn` on the machine to list every listening port and the process that owns it.

What this covers

Whether you're troubleshooting a service that won't respond, auditing a server, or just curious what's listening, checking open ports is a two-layer job: what this machine is serving, and what the network can reach. This guide walks through both, using only commands appropriate for a Linux terminal.

See what's listening locally with ss

Start on the machine itself: ss lists every listening TCP/UDP socket together with the owning process, so you immediately know which services hold which ports. Run it with sudo so process names aren't hidden. You've got what you need when you can match each LISTEN line to a port and a process name.

LinuxInspect open sockets with ssMedium riskStep 1

See which services listen on which ports and who is connected — the modern netstat replacement.

Command
$ sudo ss -tulpn

Identify the processes behind the ports

If ss shows a port held by a process you don't recognize, take a full process snapshot to see its owner, CPU/memory footprint and full command line. This helps you decide whether a listener is legitimate before you go further. Done when every unfamiliar port maps to a process you understand.

Use the classic ps aux command to list every process on the system with owner, CPU, memory, and command columns.

Command
$ ps aux

Optionally discover which hosts are up first

If your goal is to check ports across a network rather than on one known machine, run a ping sweep first to list the live hosts in the subnet. This avoids wasting a full port scan on machines that are offline. Done when you have a shortlist of IP addresses to scan.

LinuxDiscover live hosts on a subnet with nmap -snMedium riskStep 3Optional

Run a ping sweep that lists online machines without wasting time on port scanning — the forgotten first step of any network audit.

Command
$ sudo nmap -sn 192.168.1.0/24

Scan the host's full port range with nmap

For an external view — what the rest of the network can actually reach — run a version scan across all 65535 ports on the target host. This catches services ss might miss from another angle and shows service versions you can compare against known issues. Only scan machines you administer. Done when you have a complete list of open ports and service versions.

Enumerate every open port and running service version on a machine you administer.

Command
$ nmap -sV -p- 192.168.1.10
!Port scanning can look like an attack. Only scan hosts and networks you own or have explicit permission to test.

How to confirm it worked

You can list every listening socket with its owning process on the host, and an nmap scan from another machine returns the same set of open ports with service versions.

Sources

  • ss(8) — Arch Manual Pages
    Arch Linux · community · 2026-09-17
    Evidence: Same options documented for ss, another utility to investigate sockets.
  • ss(8) — Debian bookworm
    Debian Manpages · community · 2026-09-17
    Evidence: Documents -t/--tcp, -u/--udp, -l/--listening, -p/--processes and -n/--numeric for the socket statistics tool.
  • Ubuntu Manpage: ps - report a snapshot of the current processes
    manpages.ubuntu.com · technical · 2026-09-17
    Evidence: "ps displays information about a selection of the active processes"; the u option selects the user-oriented format with USER, %CPU, %MEM, and COMMAND headers.
  • ps - report a snapshot of the current processes
    man7.org · technical · 2026-09-17
    Evidence: The ps page documents the a, u, and x options ("u Display user-oriented format" including USER, %CPU, %MEM, and COMMAND columns) and describes ps as reporting "a snapshot of the current processes".
  • Host Discovery — Nmap Reference Guide
    nmap.org · vendor-doc · 2026-09-17
    Evidence: Documents -sn (ping scan, no port scan) and default discovery probes per target type.
  • nmap(1) — Debian manpage
    Debian · community · 2026-09-17
    Evidence: Debian manpage describes nmap's -sV version detection and -p- to scan ports 1-65535
  • nmap(1) — Ubuntu manpage
    Ubuntu · community · 2026-09-17
    Evidence: Ubuntu manpage documents -sV service/version detection and -p- (all 65535 ports) port specification

Last verified: 2026-09-21

Related guides