I just try pkill xterm and here is the result:
[oesser@xxxxxxxxx ~]$ pkill xterm pkill: no matching criteria specified Try `pkill --help' for more information.
pkill works properly except that it does not want to kill xterm ?! The only explanation that I see is that pkill mistake "xterm" for options. But it does not seems to support the "--" (end of options). Anyway that is weird...
Last edited by olive (2012-07-11 20:46:39)
have you tried preg to verify that the process is called 'xterm'?
Yes and pgrep does find the xterm. Anyway pkill does not fail like that if it cannot find a process:
[oesser@xxxxxxxxx ~]$ pkill jhfjhzefjherfzezezfz [oesser@xxxxxxxxx ~]$ echo $? 1
[oesser@xxxxxxxxx ~]$ pkill xterm pkill: no matching criteria specified Try `pkill --help' for more information. [oesser@xxxxxxxxx ~]$ echo $? 1
pkill xterm fails the same way as if you call pkill without any argument.
Last edited by olive (2012-07-11 20:54:19)
I can confirm that this happens on my Arch install as well. To kill xterm I have to use
kill $(pidof xterm)
If I just use "pkill xterm" I get the same error Olive gets. On the other distros I have available, "pkill xterm" does work.
(edit) removed "-9" from the kill command (got that from a google search, obviously not a good idea and it works without; thanks MrCode)
Last edited by 2ManyDogs (2012-07-11 22:01:10)
I'm getting the same thing, actually:
lappy486 ~ $ pkill "xterm" pkill: no matching criteria specified Try `pkill --help' for more information. lappy486 ~ $ pgrep "xterm" 28211 lappy486 ~ $ kill `pgrep "xterm"` lappy486 ~ $
BTW, I'd seriously recommend against using (p)kill -9, except in bad emergencies; it doesn't allow processes to do cleanup/free memory before being removed from the process queue.
EDIT: This isn't really a problem for me, as I don't use plain xterm. I was just chiming in because I was able to reproduce the issue.
Last edited by MrCode (2012-07-11 21:29:30)
I stumbled across this post while trying to figure out why i can't pkill dbus. As it turns out procps-ng v3.3.3 has a bug that causes it to interpret `xterm' as `-term' and `dbus' as `-bus'. I.e it skips the first character when trying to match signal names..
Anyway, this appears to be fixed, perhaps accidentally, here:
You should be able to `pkill xter' without a problem, assuming you don't have any other programs running that match xter..