This is so useful when trying to find runaway node processes.
Why not use killall -9 node?
killall -9 node
I'd like to add 'screen' to the list. Useful when you want to leave your terminal session running after leaving VPS.
You usually don't want to kill all your node processes, just the one that's running away...
and using SIGKILL like a hammer is a slippery slope.
yep! VSCode and other processes spin up their own node processes. I'd want to kill a specific one.
What doesn't help is that if you're using webpack or nodemon, or a combination of tools, they'll just spin up another node process as soon as you kill it.
This made me remember an incident at work sometime around 2006/07 when a colleague who only knew Linux typed killall without arguments on a HP-UX machine to get the usage instructions, not realizing that this will kill all active processes (HP-UX killall manpage). He had to call someone in the data center to get the machine rebooted 😂
For me killall proved useful when working with PHP. For example when there is this one rogue script that did not finish like it should. killall -9 php is not a problem because apache will spawn another one as soon as new request is made, but currently made request would be interrupted, so I only use in dev env.
killall -9 php
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.