How to kill a process on a port on ubuntu

前端 未结 27 2228
天涯浪人
天涯浪人 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 04:07

    Try this:

    lsof -i :port
    
    or 
    
    sudo kill $(sudo lsof -t -i:8000)
    
    or
    
    kill -9 <pid>
    
    or 
    
    sh killport 8000
    
    0 讨论(0)
  • 2020-12-02 04:08

    The best way to kill a port in ubuntu terminal is fuser -k 9001/tcp

    0 讨论(0)
  • 2020-12-02 04:08

    Its two steps process:

    1. Know process id on port no. 8080 (can be any)
    2. Kill process of that id 8689 (can be different)

      fuser -n tcp 8080
      
      #o/p 8080/tcp    8689
      
      kill -9 8689
      
    0 讨论(0)
提交回复
热议问题