Linux – Kill all processes for a user
Posted by Josh on Tue 27 Feb 2007Categories: Linux - [11] Comments
Click to play tutorial:

To kill all processes for a single user, use the following command:
pkill -u username
Click to play tutorial:

To kill all processes for a single user, use the following command:
pkill -u username
July 5th, 2008 at 2:46 pm
[...] Here is a flash demo of this command, I think you can find it useful. [...]
October 14th, 2009 at 3:18 pm
This command works really good for what it’s advertised to do.. um, thats all I have.
Oh, it wont kill YOUR local term if you execute the command as the username you’re pkilling. So that’s something good if you’re trying to kill a rouge fork bomb or script but not your local session.
November 26th, 2010 at 1:56 pm
“Oh, it wont kill YOUR local term if you execute the command as the username you’re pkilling.”
Yes, BUT: if it’s a SSH into the username account on a REMOTE server, it WILL close both SSH session into the user and the local terminal. It might still be useful for some quick fixes (kill all runaway processes, close the term and be done with it) but if you depend on the terminal to stay open, you better run pkill as root (root of the remote server that is).
Oh, and since we may be talking about different versions of pkill, I’ve used the stock one from Ubuntu 10.04 distro. And the shell was bash on both local and remote – it may have something to do with the behavior.
Cheers!
February 25th, 2011 at 3:43 am
[...] Found this a good brief tutorial on the Internet. All credits goes to Blindhog.net [...]
November 21st, 2011 at 3:29 am
Thanks, does what it says on the tin!
As other people have said, if you are logged in as the user via SSH then it will close the terminal window too.
January 27th, 2012 at 2:27 pm
Thanks a lot. It took some time for all the processes to be killed but at the end I was saved
January 28th, 2012 at 11:10 pm
putty rules!
July 2nd, 2012 at 3:59 pm
I’m a beginner who’s been shoved onto linux without any instruction, I just found this and wanted to check:
I think I’ve got some runaway processes from ssh’ing in. I want to just kill everything I’ve got and start afresh. Will this do it for me?
Cheers, looks promising!
August 28th, 2012 at 8:54 pm
[...] http://www.blindhog.net/linux-kill-all-processes-for-a-user/ (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = [...]
February 20th, 2013 at 10:52 pm
“blindhog.net Linux – Kill all processes for a user” genuinely causes myself contemplate a little bit
extra. I actually loved every single part of it.
Thank you ,Buford
March 18th, 2013 at 3:20 pm
[...] HOWTO: Kill all processes for a user – Linux March 19, 2013 By Adi S #leftcontainerBox { position: fixed; top: 60%; left: 70px; } Found this a good brief tutorial on the Internet. All credits goes to Blindhog.net [...]