Find and Kill the Process Using a Port

Figure out which process is bound to a port — the classic "address already in use" error — and stop it.

beginner5 minmacos · windows · linuxUpdated August 2026
#networking#ports#troubleshooting

Requirements

  • Terminal access

Choose your platform

0/2 steps · 0%
01

Find the process on a port

bash
$ lsof -i :{{PORT}}

Expected output

COMMAND   PID  USER   FD   TYPE DEVICE  NAME
node     1234  you    22u  IPv4  ...   TCP *:3000 (LISTEN)
02

Kill it

bash
$ kill -9 {{PID}}

Tip

Take {{PID}} from the PID column in the previous step's output.

Troubleshooting

`lsof` isn't installed by default on every Linux distribution.

bash
$ sudo apt install lsof