Search code examples
windowscygwinkillxargs

Cannot kill a windows process in cygwin


I can kill a windows process in Cygwin with the command:

$ echo "4128" | xargs kill -f

but cannot do it with the following command:

$ kill -f 4128
-bash: kill: f: invalid signal specification

According to documentation of kill the syntax should be correct https://cygwin.com/cygwin-ug-net/kill.html

You can find there:

$ kill -f 123

Why doesn't the second command work?


Solution

  • Cygwin has 2 kills:

    $ type -a kill
    kill is a shell builtin
    kill is /usr/bin/kill
    

    The shell builtin does not support the -f option. You need to use the kill executable:

    /bin/kill -f
    

    Or:

    env kill -f