Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a problem regarding how to kill a process in Cygwin on Windows. I am completely new to Cygwin. But I have a task that I simply cant kill. I have tried issuing the following commands:

kill 4568
kill -9 4568
/bin/kill -f 4568

I have issued the commands in a separate Cygwin terminal since I cannot Ctrl+C it in the Cygwin terminal where the process run. I have searched all over the internet without success.

share|improve this question

migrated from Jun 21 '12 at 0:50

This question came from our site for professional and enthusiast programmers.

What's the process you started, and how did you start it? – me_and Jun 1 '12 at 11:27
See also… – me_and Jun 21 '12 at 9:18
ps -W | awk '/calc.exe/,NF=1' | xargs kill -f


ps -W | awk '$0~v,NF=1' v=calc.exe | xargs kill -f


powershell kill -n calc
share|improve this answer
Thanks for this, learned some new commands! – MalsR Aug 21 '12 at 10:58
kill -f <pid> didn't work for me. but kill /bin/kill worked for me. thank you. – ruseel May 11 '13 at 6:22
What does NF=1 mean? – CMCDragonkai May 26 '14 at 2:57
@CMCDragonkai it means, only print the first field – Steven Penny May 26 '14 at 3:54

You may try:

taskkill /pid 4568
share|improve this answer
taskkill /im:{name-of-executable} is useful as well. – LawrenceC Jun 25 '12 at 23:54
and taskkill /im <name-of-exe> /f is even more useful. – Erik Allik Sep 16 '12 at 15:36

(From my answer to a similar question on SO):

Different Windows programs will handle the signals that kill sends differently; they've never been designed to deal with them in the same way that Linux/Cygwin programs are.

The only reliable method for killing a Windows program is to use a Windows specific tool, such as Task Manager or Process Explorer.

That said, if you've not already, you may have luck with running your Cygwin terminal in administrator mode (right click on your shortcut and select "Run as administrator").

share|improve this answer

If you want a BASH only solution, try this: (it works for me)

    KILLPS="<My Process Name>"
    WINPS=`ps -W | grep -i $KILLPS`         # Make case-insensitive.
    PID=`echo $WINPS | cut -d' ' -f1` 
    /bin/kill -f "$PID"

NOTE: use /bin/kill, the embedded shell kill will not kill PIDs for general windows proccesses.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .