Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to kill a process in cygwin?

Hi i have the following process which i cant kill:

The process to be killed.

I am running cygwin in windows xp 32 bit.

I have tried issuing the following commands:

/bin/kill -f 4760 /bin/kill -9 5000 kill -9 5000 kill 5000 

When i write /bin/kill -f 4760 i get the message, 'kill: couldn't open pid 4760'.

When i write /bin/kill -9 5000 i get the message, 'kill: 5000: No such process'.

I simply don't understand why this process cant be killed. Since it has a WINID shouldnt it be killed by /bin/kill -f 4760?

hope someone can help thx :)

like image 850
Diemauerdk Avatar asked Jun 04 '12 07:06

Diemauerdk


People also ask

How do I terminate a Cygwin process?

Use -f to terminate native Windows processes not started by Cygwin processes. -f can also be useful to terminate Cygwin processes not answering to SIGKILL. Unless you specific the -W option, the "pid" values used by kill are the Cygwin pids, not the Windows pids.

What is kill in Cygwin?

kill [-f] [-signal] [-s signal] pid ... The kill program allows you to send arbitrary signals to other Cygwin programs.

How do I get a list of running programs in Cygwin?

Unless you specific the -W option, the "pid" values used by kill are the Cygwin pids, not the Windows pids. To get a list of running programs and their Cygwin pids, use the Cygwin ps program. ps -W will display all windows pids. The kill -l option prints the name of the given signal, or a list of all signal names if no signal is given.

What is winpid and how do I Kill a Cygwin server?

The WINPID is also the PID, and they can be killed with the Cygwin kill command's -f option.


2 Answers

The process is locked from Windows most likely. The error you are getting "couldnt open PID XXX" points to this. To confirm try killing it with windows taskkill

    taskkill /PID 4760 
like image 172
kjp Avatar answered Sep 20 '22 15:09

kjp


Strangely, the following works in Cygwin:

echo PID1 PID2 PID3 | xargs kill -f 

For example:

ps -W | grep WindowsPooPoo | awk '{print $1}' | while read line; do echo $line | xargs kill -f; done; 
like image 32
nino Avatar answered Sep 19 '22 15:09

nino