End all processes belonging to a user (Linux)

You may, at some point, need a quick way to end all processes for a specific username, instead of listing them all and going through each one.  Sure, you could write a small script to do this, and that’s what the developer of slay has done.

slay is a shell script which, when given a username as an argument, ends all processes belonging to that user – simple.

Of course, if you slay the username you are currently logged on as, you’ll get logged off, but it does work. Likewise, if you slay another username, they will be logged off and whatever they were doing ended.

I’ve used slay many times to end processes which have started on my own user account in the background, and I couldn’t be bothered to do it manully.

Of course, to end another users’ processes, you will need to be root.

slay is a already packaged in Ubuntu and Debian (apt-get install slay), and it’s probably packaged in your distribution too, so take a look.  Be careful though, because it’s quite unforgiving – it just does it, and people may have important processes running!

You can read the slay manpage here:  http://manpages.ubuntu.com/manpages/jaunty/man1/slay.1.html