↑↓ move Enter open Esc close

How to Find Which Process Is Using a Port in Linux

Identify the PID and program listening on a Linux TCP port.

When a server says a port is already in use, identify the owning socket first and inspect the process before acting.

Step by step

1 Check the socket

$ sudo ss -ltnp | grep :3000

Shows listening TCP sockets and process information.

2 Inspect the PID

$ ps -fp 12345

Confirm the program and arguments before stopping anything.

3 Stop a known leftover process

$ kill 12345

SIGTERM asks it to exit cleanly.

Tips worth knowing

Frequently asked questions

How do I check what is using port 3000?

Use `sudo ss -ltnp | grep :3000`.

How do I free a port safely?

Identify and verify the owner, then stop it cleanly or through its service manager.

If it goes wrong

The commands behind it

Concepts involved: Port · PID (Process ID)

More how-to guides