Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
3  
All processes? sudo reboot –  Stephen Jul 8 '10 at 23:42
1  
Are you talking about processes owned by you, or all processes in the currently running system? –  J. Polfer Jul 8 '10 at 23:45
2  
@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
add comment

migrated from stackoverflow.com Jul 8 '10 at 23:46

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

9 Answers

shutdown -h now

share|improve this answer
add comment

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

More information here: http://linux.about.com/library/cmd/blcmdl8_killall5.htm

share|improve this answer
add comment

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
1  
When I switch my computer to runlevel 0 it actually turns off... –  David Z Jul 9 '10 at 1:24
1  
It seems that it depends on your flavour of Linux - en.wikipedia.org/wiki/Runlevel#Linux - will edit my answer a bit. –  x3ja Jul 9 '10 at 1:34
add comment

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

killall -u username

or

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
add comment

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
add comment

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
add comment

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

share|improve this answer
1  
FTFY: s/proof/ish/ –  Chris Nava Feb 1 '12 at 17:31
3  
:-) 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
1  
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
2  
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
add comment

You can use the following kill command also.

kill -15 -1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.