A process with name=example can be killed by
killall -9 example
How to kill multiple instances of following command which contain spaces?
"valgrind –tool=lackey ./testcases/kernel/syscalls/waitpid/waitpid03"
Following command returns valgrind –tool=lackey ./testcases/kernel/syscalls/waitpid/waitpid03: No such file or directory
killall -9 "valgrind –tool=lackey
./testcases/kernel/syscalls/waitpid/waitpid03"
Best Answer
killall valgrind
will kill allvalgrind
processes regardless of arguments. If you want to kill only processes whose command line is exactlyvalgrind --tool=lackey ./testcases/kernel/syscalls/waitpid/waitpid03
, you can usepkill
:Like
killall
,pkill
is on every non-embedded (and some embedded) Linux installations, and it's more powerful and often more reliable (but for some reason less well-known). The companion utilitypgrep
is identical except that it lists the PIDs instead of killing.Another utility you may be interested in is
fuser
:fuser testcases/kernel/syscalls/waitpid/waitpid03
lists the processes that have the specified file open, andfuser -k
would send a signal to these processes. When you're not trying to send a signal,lsof
is a more powerful alternative tofuser
(shows more stuff, has more filters).