Tuesday·30·August·2011
Useful but Unknown Unix Tools: Kill all processes of a user //at 22:15 //by abe
I already got mails like “What a pity that your nice blog posting series ended”. No, it didn’t end. As announced, I knew that I won’t be able to keep up a daily schedule. It worked as long as I had already written the postings in advanced. But in the end the last postings were already written just in time and then I ran out of leisure and muse for a time. But as I said: It didn’t end, it will be continued. And this is the next such posting.
Oh, and for those who tell me further tools, I should blog about: I appreciate that, especially because that way I also hear about tools I didn’t know about. But why just telling me and not blogging yourself about it? :-) At least those whose blog is part of Planet Debian or Planet Symlink anyway really should do this themselves. I’d really like to see also others writing about cool tools. I neither have a right on the idea nor on the name of this series (call it meme if you want :-), so please go on and publish your favourite tools in a blog posting, too. :-)
And for all those who want to join me and Myon blogging about cool Unix tools, independent if listed on Planet Debian or Planet Symlink, I encourage you to offer a separate feed for this kind of postings and join us on Planet Commandline.
Anyway, here’s the next such posting:
As system administrator you often have the case that you have to kill all processes of one user, e.g. if a daemon didn’t properly shut down itself or amok running leftovers of a GUI session.
Many use pkill -SIGNAL -u user
from the
procps package or killall -SIGNAL -u user
from the psmisc package for it. But that’s a) quite
cumbersome to type and b) is there a chance to forget about the -u and
then bad things may happen, especially with pkill’s default substring
match, so I prefer another tool with a more explicit name:
slay
slay has an easy to remember name (at least for BOFHs ;-)
which is even quicker to type (alternating one character with the left
and the right hand, at least on US layout keyboards) than “pkill” (all
characters to type with the right hand), and has the same easy to
remember commandline syntax like kill
itself:
slay -SIGNAL user [user …]
But beware, slay is…
… not only for BOFHs, but also from a BOFH
It has a “mean mode” which is activated by default. With mean mode on, it won’t kill the given user but the user who called the program if it is invoked as an ordinary user without root rights. *g*
Interestingly I never ran into this issue despite I use this program often and for many years now.
But some Ubuntu users did, probably because adding a
sudo
in front of some command is easier to forget than
doing an ssh root@localhost
or su -
beforehand. They even seem to be so desperate about it that they forwarded the issue
from Launchpad to the Debian Bug Tracking System. ;-)
But to be honest — even if I was very amused about those bug reports — isn’t this issue “grave”, as it causes very likely (unexpected) data loss?
Now playing: Monzy
— kill dash nine (… and your process is mine
;-)
Tagged as: blog, BOFH, BTS, kill, kill dash nine, killall, Launchpad, Lyrics, Now Playing, nuggets, Other Blogs, pkill, Planet Commandline, Planet Debian, Planet Symlink, procps, psmisc, slay, sysadmin, Ubuntu, UUUT
// show without comments // write a comment