Skip to content

Ferdinand Agyei-Yeboah

Finding Process On Port

October 22, 2020

You might want to find (and kill) a process on a port. Here’s how.

Mac/Linux

Find process on port. You may need to use sudo if the process was started by root (or else it will not show up).
sudo lsof -i :<port>

Kill process on port
sudo kill -9 $(sudo lsof -ti:<port>)

Windows

Note: You may need to run the command prompt as an admin.

Find process on port. The PID (process id) will be the last column.
netstat -ano | findstr :<port>

Kill process on port (using PID)
taskkill /PID <pid> /f


Software Engineering Tutorials & Best Practices