How to kill a process in MacOS?

后端 未结 9 1748
日久生厌
日久生厌 2021-01-30 04:05

I tried kill -9 698 but the process did not die.

$ ps -ef | grep chromium
  502   698   811   0   0:01.24 ??         0:07.28 /Users/lucius/chromium/         


        
9条回答
  •  旧巷少年郎
    2021-01-30 04:30

    Some cases you might want to kill all the process running in a specific port. For example, if I am running a node app on 3000 port and I want to kill that and start a new one; then I found this command useful.

    Find the process IDs running on TCP port 3000 and kill it

    kill -9 `lsof -i TCP:3000 | awk '/LISTEN/{print $2}'`
    

提交回复
热议问题