Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to kill all processes on my computer. Which command can I use to do so?

share|improve this question

migrated from Jul 8 '10 at 23:46

This question came from our site for professional and enthusiast programmers.

All processes? sudo reboot – Stephen Jul 8 '10 at 23:42
Are you talking about processes owned by you, or all processes in the currently running system? – J. Polfer Jul 8 '10 at 23:45
@Stephen - then s/he'd just end up with all the processes restarting and that's the last thing you want when you want them all DEAD! – x3ja Jul 9 '10 at 1:38

shutdown -h now

share|improve this answer

The command killall5 -9 will forcefully terminate all running processes except your login shell, init, and kernel-specific processes.

More information here:

share|improve this answer

In some Linux distros, you can switch to Run Level 0 - which I think is halted, but still switched on:

sudo telinit 0

I've actually heard of this being used for dedicated firewall servers since it keeps some of the needed low-level kernel stuff loaded like iptables... weird eh? See here for more info.

To see which distros do what at each runlevel, have a look here.

share|improve this answer
When I switch my computer to runlevel 0 it actually turns off... – David Z Jul 9 '10 at 1:24
It seems that it depends on your flavour of Linux - - will edit my answer a bit. – x3ja Jul 9 '10 at 1:34

You can kill all of a given user's processes using one of these:

killall -u username


pkill -u username

or you can use the numeric UID instead of the username.

Beware that killall functions differently (similarly to killall5) on some systems such as Solaris.

share|improve this answer

The easiest way is to use the Magic SysRq key : Alt+SysRq+i. This will kill all processes except for init.

Alt+SysRq+o will shut down the system (killing init also).

Note that you may need to set the keyboard to XLATE mode first : Alt+SysRq+r

Also note that on some modern keyboards, you have to use PrtSc rather than SysRq.

share|improve this answer
Please note that it's recommended to use Alt+Shift+SysRq+reisub for a safe reboot. – l0b0 Feb 1 '12 at 17:13

To kill all processes owned by the current user you can do:

ps x | awk {'print $1'} | xargs kill

This will of course, also kill the shell you are currently logged in from. If you don't want that behaviour, try raku015's answer.

Note that if you run this as the root user, bad things will happen.

share|improve this answer

The quickest, most foolproof way to kill all processes is to pull the power cord from the wall.

share|improve this answer
FTFY: s/proof/ish/ – Chris Nava Feb 1 '12 at 17:31
:-) That's a matter of opinion. The OP didn't specify what the desired goal was beyond "kill all processes". I think it'd be foolish to have any command to kill all processes. – Doug Harris Feb 1 '12 at 17:53
I agree. Not to mention that it's also a bit hard on the file system to kill power like that. – Chris Nava Feb 1 '12 at 18:19
And remove the battery if it's a laptop. – Keith Thompson Feb 1 '12 at 22:31
And encase it in cement to make sure it never has any new processes launched? – Mokubai Feb 1 '12 at 22:32

You can use the following kill command also.

kill -15 -1

share|improve this answer
kill -9 -1 
kill -kill 0
share|improve this answer

You must log in to answer this question.