Didn’t you sometimes wish you had a ‘superkill’; a kill that kills all processes with a certain text in it. Killall is supposed to do that, but actually never does, as you have to type the complete command which is a pain. So I usually type:
ps auxw|grep -i apache|awk ‘{print $2}’|xargs kill -9
in this case killing Apache (1 and 2).
To make life easier, as a regular part of my Debian and Ubuntu installs, I now have the command ‘sk’ (superkill) in /usr/sbin/sk;
#!/bin/sh
ps uaxw|grep -i $1|grep -v $0|grep -v grep|awk ‘{print $2}’|xargs kill -9
allowing me to run;
sk apache
and gone it is.
Now that I am writing this anyway; here is another missing command 🙂
find /some/directory -maxdepth 1 -type f -mtime +2 -exec rm {} ;
Into a file /usr/sbin/ro;
#!/bin/sh
find $1 -maxdepth 1 -type f -mtime +$2 -exec rm {} ;
Be the first to leave a comment. Don’t be shy.