Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 cant CTR-C it in the cygwin terminal where the process run. I have searched all over the internet without success :(

hope someone can help thanks :)

share|improve this question

migrated from stackoverflow.com 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 stackoverflow.com/questions/10877652/… –  me_and Jun 21 '12 at 9:18

5 Answers 5

ps -W | awk '/calc.exe/,NF=1' | xargs kill -f

Or

ps -W | awk '$0~v,NF=1' v=calc.exe | xargs kill -f
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 at 2:57
1  
@CMCDragonkai it means, only print the first field –  Steven Penny May 26 at 3:54

You may try:

taskkill /pid 4568
share|improve this answer
    
taskkill /im:{name-of-executable} is useful as well. –  ultrasawblade 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

Try this:

Usage: kill [-f] [-signal] [-s signal] pid1 [pid2 ...]
       kill -l [signal]

Send signals to processes

 -f, --force     force, using win32 interface if necessary
 -l, --list      print a list of signal names
 -s, --signal    send signal (use kill --list for a list)
 -h, --help      output usage information and exit
 -V, --version   output version information and exit
share|improve this answer
1  
Try what? That's just the kill usage instructions, not anything to actually try. The only thing of any obvious use there is the -f option, which the OP says they have already tried. –  me_and Jun 1 '12 at 11:36
    
yes i have tried that, no luck. –  user1093774 Jun 1 '12 at 11:43

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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