Incoming from windows - easy taskkill
Posted: Mon Jul 02, 2012 3:23 am
Ok, now this is for all you people coming in from windows (it can be useful to veterans too, though as a light utility, nothing more).
You probably remember this:
Now when you tried doing, say, this:
it asked you for a pid. After googling you did this:
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:
What this does: it accepts something like
(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:
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.
You probably remember this:
Code: Select all
taskkill /IM something.exe
Code: Select all
kill brasero
Code: Select all
pidof brasero
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
Code: Select all
nkill brasero gedit firefox
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
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.