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

🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source & DevOps topics via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
6 comments… add one
  • Brian Feb 20, 2014 @ 21:57

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

  • John Nov 19, 2013 @ 16:06

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

    It kills everything, desktop included.

  • Pradeep May 23, 2013 @ 15:00

    this will leave your current session alive.

    killall5 -9

  • Renz Jan 19, 2013 @ 13:52

    fuck you dude, your guide is inorrect

    its kill all even ssh

  • weedjoint Jan 6, 2011 @ 14:21

    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 Dec 20, 2012 @ 3:43

      Thats true. It kills current session as well.

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.