You probably remember this:
- Code: Select all
taskkill /IM something.exe
Now when you tried doing, say, this:
- Code: Select all
kill brasero
it asked you for a pid. After googling you did this:
- Code: Select all
pidof brasero
and had to write it manually.
Well these days are over! There's actually a pretty simple way to get this working. I wrote a small (technically under 1kb) script that does it for you. The basic script is as follows:
- Code: Select all
#!/bin/bash
#nkill by Shingetsu (http://forums.linuxmint.com/memberlist.php?mode=viewprofile&u=89380)
PROCS="$@"
for p in $PROCS
do
kill `pidof $p`
done
What this does: it accepts something like
- Code: Select all
nkill brasero gedit firefox
(I call it nkill (n for Name)).
Basically the name of every process you send as an argument is checked, then killed. This sends the SIGTERM command. SIGTERM won't ALWAYS work, however It is safer though. For a more "effective script, consider this:
- Code: Select all
#!/bin/bash
#fnkill by Shingetsu (http://forums.linuxmint.com/memberlist.php?mode=viewprofile&u=89380)
PROCS="$@"
for p in $PROCS
do
kill -9 `pidof $p`
done
The -9 here sends the SIGKILL signal. While always effective, and can result an consequences in certain cases.
I was going to make a last version of the script... one where 1st parameter decides whether to use -9 or not, but got lasy and just made the -9 version fnkill.
Anyway, put this script into /usr/bin under the name nkill and/or fnkill and you can go around using it (should work in alt+f2 also).
Use this with great responsibility. Thank you all
P.S.* Yes this is selfish propaganda. Yes this is still useful. The real reason I posted is in the case I kill my comp so I can get the script back.
P.S.S. * This should be compatible with sudo -> with it, the program would be run as root and as such all commands in it would have the "sudo su" effect. So that will work too.





