How do I check which process is using a port on Linux?

Updated October 2026 · How we answer

Short answerRun sudo ss -tulpn to list listening ports and the process behind each one, or add grep for one port, such as sudo ss -tulpn | grep :8080.

Use ss to list listening ports

The ss command shows sockets and the programs that own them. The flags t, u, l, p and n show TCP and UDP sockets, listening state, process names and numeric ports. Using sudo gives you process names for services owned by other users, which you may not see otherwise.

Look at the Local Address column for the port you care about, then check the Process column for the program name and process ID. The PID lets you investigate further with ps -p PID -o pid,cmd.

  • sudo ss -tulpn to see all listening ports
  • sudo ss -tulpn | grep :3000 to filter one port
  • ps -p 1234 -o pid,cmd to inspect a PID
  • Confirm what a process is before you stop it

Older tools and safer stops

On older systems, netstat -tulpn does a similar job, but it may need the net-tools package installed. lsof -i :8080 is another option on many distributions and shows the command name clearly.

Stopping a process should be a deliberate step. If the process is a system service, stopping it with systemctl is usually safer than killing it directly. Killing a managed service can cause it to restart right away.

Common mistakes

  • Killing a process that is a managed service, which may restart automatically.
  • Running ss without sudo and missing the process name for root-owned services.
  • Assuming the port belongs to your app when it may belong to a database or proxy.
From our shopsCASEONYX: Dark-luxe tough phone cases.