Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Kill process by name instead of PID' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Kill process by name instead of PID
Authored by: kal on Jun 24, '03 12:21:59PM
This might be a too convenient way of doing things, actually. Anything that matches your text string will be killed, which is why I think it is "too convenient". For instance,
pkill ssh
will attempt to kill every process with the text string "ssh" in it, including not only ssh-sessions, but also ssh daemons and your ssh-agent. Which is why this script should never be run as superuser (I could find a lot worse examples than with ssh above).... Personally, i prefer double checking processes before i kill them. Look them up with ps and kill them with kill, slightly inconvenient, but safe

[ Reply to This | # ]
Kill process by name instead of PID
Authored by: mervTormel on Jun 24, '03 01:09:23PM

yeah, gotta agree with kal, this is an extremely bad practice. one needs to know the potential effect of blindly running this kind of operation.



[ Reply to This | # ]
Kill process by name instead of PID
Authored by: code_masseur on Apr 28, '04 06:53:19PM

Why not use the "-w" flag for grep to match on a whole word?



[ Reply to This | # ]