How to kill a process on a port on ubuntu

前端 未结 27 2237
天涯浪人
天涯浪人 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

    There are some process which does not shown using normal netstat command, so you have to check it using sudo.

    Do sudo netstat -lpn |grep :8080. Process running by system does not show PID, to get PID of this process you will have to run it using sudo

    And then killl the process using port 8080. You may have to use sudo here as well. So to kill this process use sudo kill -9 PID

提交回复
热议问题