How to kill a ubuntu port process

July 23, 2024

First you need to identify the Process ID PID using the port.

lsof -i :PORT # For example: lsof -i :3000

Once you have the PID you can use the kill command to kill the process.

kill PID # For example: kill 12345

If the process does not terminate, you can use the -9 option to forcefully kill it.

kill -9 PID # For example: kill -9 12345