Stop node.js program from command line Stop node.js program from command line node.js node.js

Stop node.js program from command line


To end the program, you should be using Ctrl + C. If you do that, it sends SIGINT, which allows the program to end gracefully, unbinding from any ports it is listening on.

See also: https://superuser.com/a/262948/48624


Ctrl+Z suspends it, which means it can still be running.

Ctrl+C will actually kill it.

you can also kill it manually like this:

ps aux | grep node

Find the process ID (second from the left):

kill -9 PROCESS_ID

This may also work

killall node


Or alternatively you can do all of these in one line:

kill -9 $(ps aux | grep '\snode\s' | awk '{print $2}')

You can replace node inside '\snode\s' with any other process name.