How to kill a nodejs process in Linux?

2020-05-11 19:30发布

tcp    0     0 0.0.0.0:80     0.0.0.0:*     LISTEN      9631/node    

How do I kill this process in linux(ubuntu)?

6条回答
Evening l夕情丶
2楼-- · 2020-05-11 20:13

pkill is the easiest command line utility

pkill -f node

or

pkill -f nodejs

whatever name the process runs as for your os

查看更多
ゆ 、 Hurt°
3楼-- · 2020-05-11 20:20

You can use the killall command as follows:

killall node
查看更多
劳资没心,怎么记你
4楼-- · 2020-05-11 20:20

Run ps aux | grep nodejs, find the PID of the process you're looking for, then run kill starting with SIGTERM (kill -15 25239). If that doesn't work then use SIGKILL instead, replacing -15 with -9.

查看更多
女痞
5楼-- · 2020-05-11 20:23

if you want to kill a specific node process , you can go to command line route and type:

ps aux | grep node

to get a list of all node process ids. now you can get your process id(pid), then do:

kill -9 PID

and if you want to kill all node processes then do:

killall -9 node

-9 switch is like end task on windows. it will force the process to end. you can do:

kill -l

to see all switches of kill command and their comments.

查看更多
来,给爷笑一个
6楼-- · 2020-05-11 20:24
sudo netstat -lpn |grep :'3000'

3000 is port i was looking for, After first command you will have Process ID for that port

kill -9 1192

in my case 1192 was process Id of process running on 3000 PORT use -9 for Force kill the process

查看更多
Explosion°爆炸
7楼-- · 2020-05-11 20:28

In order to kill use: killall -9 /usr/bin/node

To reload use: killall -12 /usr/bin/node

查看更多
登录 后发表回答