I want to kill all processesĀ on my computer. Which command can I use to do so?
11 Answers
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
- 526
shutdown -h now
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.
- 111,445
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.
- 2,020
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.
- 317
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.
- 931
The quickest, most foolproof way to kill all processes is to pull the power cord from the wall.
- 28,397
I would use below command. (This is the one I use when I stuck)
kill -9 -1
This will kill all processes. My Environment is Ubuntu. If I type this in the terminal, it will close all the processes and will bring you to login screen (almost like logged off)
- 155