kill a pid code example

Example 1: script to kill a process in windows

taskkill /PID 1234

Example 2: kill a process with pid

kill -9 PID # kill -9 94228

Example 3: kill pid

Find PID of process to kill with:
ps ax
Then just specify "kill PID" command as for example:
kill 16320
kill -9 16320 	#Force kill in case process is not answering.

Example 4: kill pid

lsof -i:3000           // Change 3000 to whatever your port is!
sudo kill 9 <PID>      // Change <PID> to the Pid number the above command returns

Example 5: how to kill a process in linux

kill -KILL PIDnumber ... for example, kill -KILL 12345

Example 6: forever kill pid

forever list
data:    [0] 6pf0 /usr/bin/node index.js 22912   22919    /root/.forever/6pf0.log 13:0:34:50.46699999994598  
data:    [1] _tf5 /usr/bin/node index.js 23220   23227    /root/.forever/_tf5.log 13:0:34:38.924000000115484 
data:    [2] 6pVb /usr/bin/node index.js 23271   23278    /root/.forever/6pVb.log 13:0:34:27.212999999988824 
forever kill 0

Tags:

Misc Example