Linux kill all active process except your login session with killall5 command

by on August 22, 2007 · 6 comments· LAST UPDATED August 22, 2007

in , ,

Almost all UNIX SystemV version has killall command which is used to kill all active processes i.e. terminates all processes with open files so that the mounted file systems will be unbusied and can be unmounted.

However Linux killall command used to kill processes by name (if no signal name is specified, SIGTERM is sent). If you missed old good SysV killall command, try killall5 command under any Linux distro. killall5 is nothing but the UNIX SystemV killall command. It sends a signal to all processes except kernel threads and the processes in its own session, so it won’t kill the shell that is running the script it was called from.

Just type killall5 and every active process will get killed except your login session:
# netstat
# netstat -tulpn
# killall5
# netstat -tulpn

As usual,
(a) The killall command can be run only by the super-user.
(b) Use this command with caution

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 6 comments… read them below or add one }

1 weedjoint January 6, 2011 at 2:21 pm

It kills all sessions unlike what you are telling here.
Please try it out before you serve it for others; saves trouble this way!

Reply

2 Nishant December 20, 2012 at 3:43 am

Thats true. It kills current session as well.

Reply

3 Renz January 19, 2013 at 1:52 pm

fuck you dude, your guide is inorrect

its kill all even ssh

Reply

4 Pradeep May 23, 2013 at 3:00 pm

this will leave your current session alive.

killall5 -9

Reply

5 John November 19, 2013 at 4:06 pm

Ugh…I should have read the comments before trying this command.

It kills everything, desktop included.

Reply

6 Brian February 20, 2014 at 9:57 pm

This is VERY VERY WRONG, why is this still up?

Reply

Leave a Comment

Tagged as: , , , , , ,

Previous post:

Next post: