ss is the modern default, usually installed:

sudo ss -lptn 'sport = :3000'
LISTEN 0 128 *:3000 *:* users:(("node",pid=12345,fd=18))

lsof gives a clearer PID plus command path:

sudo lsof -i :3000

netstat on older systems, from net-tools:

sudo netstat -tulpn | grep :3000

Killing the holder — a plain kill first, -9 only if it refuses:

sudo kill 12345
sudo fuser -k 3000/tcp

To check a port is open, ignoring the owner:

ss -tuln | grep :3000

Usual cases: a taken port, or a Docker container colliding with a local process; in containers the answer comes from docker ps or the orchestrator, not ss on the host.

References Link to this section