How to kill a process on a port on ubuntu

前端 未结 27 2236
天涯浪人
天涯浪人 2020-12-02 03:05

I am trying to kill a process in the command line for a specific port in ubuntu.

If I run this command I get the port:

sudo lsof -t -i:9001
         


        
27条回答
  •  [愿得一人]
    2020-12-02 03:43

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

    sudo netstat -lpn |grep :8080
    

    and press Enter.

    You will get an output similar to this one

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

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

    3- Kill the process, type:kill 6782

    kill 6782
    

提交回复
热议问题