☠️Kill a process on a port [Linux]

how one can kill a process on a port on ubuntu

How to kill a process on a port on ubuntu

You want to use backtick, not regular tick:

sudo kill -p `sudo lsof -t -i:9001`

If that doesn’t work, you could also use $() for command interpolation:

sudo kill -p $(sudo lsof -t -i:9001)

FOR UBUNTU

1- Find what application/process is using the pro, type:

sudo netstat -lpn |grep :8080

and press Enter.

tcp6       0      0 :::8080                 :::*                    LISTEN      6782/java

You will get an output similar to this one

I have got the process Id, which is 6782, now this is the process that is using port 8080.

Kill the process, type: kill -p 6782

kill -p 6782

Last updated