Can't find out where does a node.js app running and can't kill it
What I did: I have just set up node environment, installed express, create and installed an express project
express hello
cd hello && npm install
then started the app with "node app
".
Environment:
yole@Yole:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.2 (wheezy)
Release: 7.2
Codename: wheezy
yole@Yole:~$ node --version
v0.10.22
yole@Yole:~$ express --version
3.4.4
Problem
When I want to stop this app, I used CTRL+C,
but the thing I found is it did not stopped. Then I restarted the server! I found I can still access the page in browser. Orz.
I have tried the following thing but still can't find out the running process.
yole@Yole:~$ killall node
node: no process found
yole@Yole:~$ ps -ef|grep node
yole 3161 2888 0 16:57 pts/1 00:00:00 grep node
yole@Yole:~$ netstat -apn|grep 3000
Question How to find out the running node process or how to kill it.
===== update It is very strange that all browses in my machine can visit the site while it's not available on other machine! I only visit the page with Chrome before I stop the application. It seems to be a cache problem, but how cache shared among browsers..
List node process:
$ ps -e|grep node
Kill the process using
$kill -9 XXXX
Here XXXX is the process number
If you want know, the how may nodejs processes running then you can use this command
ps -aef | grep node
So it will give list of nodejs process with it's project name. It will be helpful when you are running multipe nodejs application & you want kill specific process for the specific project.
Above command will give output like
XXX 12886 1741 1 12:36 ? 00:00:05 /home/username/.nvm/versions/node/v9.2.0/bin/node --inspect-brk=43443 /node application running path.
So to kill you can use following command
kill -9 12886
So it will kill the spcefic node process
You can kill all node processes using pkill node
or you can do a ps T
to see all processes on this terminal
then you can kill a specific process ID doing a kill [processID]
example: kill 24491
Additionally, you can do a ps -help
to see all the available options