I am currently using the following command to get a process:
ps -xa | grep node
Which results in the following:
13611 ? Sl 0:03 /opt/brackets/Brackets-node /opt/brackets/node-core
20713 pts/1 Sl 0:00 node --harmony app.js
20838 pts/1 S+ 0:00 grep node
I use the command kill -9 20713
to kill the node --harmony app.js
process.
How can I kill the node --harmony app.js
every single time with one command? I am tired of typing in the process number every time.
Best Answer
Use
pkill
:This would match the other command as well, so fine tune it:
This matches the full command line (
-f
) exactly, so it should only hit the desired command.