I run the node server by typing

node server.js

from a putty terminal to get it running. Now i want to stop the server how should i do it? I tried pressing the pause break button on the keyboard. But it is not stopping it.

7 Answers 7


Try using ctrl+c, usually does the trick.

  • 1
    programmatically, you can use app.close() if var app = require('http').createServer().
    – Lance
    Apr 12, 2012 at 21:19

Try from another terminal

killall node

Works in OS X and Linux. It may also prevent respawning node processes. For instance if a node some_server.js is running it may that any normal kill command (even kill -9 <PID_of_that_process> will simply result in a respawn node some_server.js process with a different PID. In that situation the only way to kill it is: killall node. I solved this issue on Redhat Linux RHEL7 but it should work the same for most Linux OS.

  • 1
    only thing that worked. Nov 5, 2017 at 9:41
  • killall node maybe more than you want when you are running MERN apps, since you will have separate instances of node running the backend Express JS app and the frontend React JS app. You can use ps -ef to identify which specific node processes should be killed off.
    – Lazor
    Jan 12, 2021 at 21:35

If you are going to use the 'top' command to kill a process, you should try sending the '2' signal first, not '9'. Sending '9' is kind of like pulling the plug on your computer instead of issuing a shutdown command. It can sometimes have some undesirable consequences. Sending '2' has the same effect as ctrl+c.

For reference, here are the different signals you can send to stop a process and what they mean: (from kill man page)

 1       HUP (hang up)
 2       INT (interrupt)
 3       QUIT (quit)
 6       ABRT (abort)
 9       KILL (non-catchable, non-ignorable kill)
 14      ALRM (alarm clock)
 15      TERM (software termination signal)

Enter 'top' at command line and find the process ID of the process you want to kill. Press 'K', it will prompt you to enter the process id that you want to kill, enter it, and press enter. It will then ask what signal you want to transmit to the process, enter '9' and press enter. The process will be killed.


On windows os in command prompt, Press CTRL + C wait till it stops if it does not then Press the CTRL + C 2 times this will definitely work.


ctrl + shift + c does the trick in ubuntu terminal

  • 1
    A Terminal shouldn't remap keys like this.
    – chicks
    Jun 25, 2018 at 18:40

I had the same problem while running npm from Babun and then i tried to use Windows CMD instead (because i had similar problem running git commands from Babun) and that showed different results.
When i run npm from CMD, i had to click Enter so that the script gets executed and then i was asked to click w to show more details.
I clicked w and that showed :

Watch Usage
› Press f to run only failed tests.
› Press o to only run tests related to changed files.
› Press p to filter by a filename regex pattern.
› Press t to filter by a test name regex pattern.
› Press q to quit watch mode.
› Press Enter to trigger a test run.

I clicked w and npm was stopped and returned control to CMD.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.