≡ Menu

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

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

Share this on:
{ 6 comments… add one }
  • weedjoint January 6, 2011, 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!

    • Nishant December 20, 2012, 3:43 am

      Thats true. It kills current session as well.

  • Renz January 19, 2013, 1:52 pm

    fuck you dude, your guide is inorrect

    its kill all even ssh

  • Pradeep May 23, 2013, 3:00 pm

    this will leave your current session alive.

    killall5 -9

  • John November 19, 2013, 4:06 pm

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

    It kills everything, desktop included.

  • Brian February 20, 2014, 9:57 pm

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

Security: Are you a robot or human?

Leave a Comment

   Tagged with: , , , , , ,