LinuxCommandLibrary

killall5

Kill all processes except the current shell

SYNOPSIS

killall5 [-l] [<signal> | -s signal] [-t TTY] [-o PIDLIST]

PARAMETERS

-l
    List all known signal names

signal or -s signal
    Signal to send (default: SIGTERM); name or number

-t TTY
    Restrict to processes on specified TTY

-o PIDLIST
    Comma-separated PIDs to omit from signaling (e.g., 1,123)

DESCRIPTION

killall5 is a low-level utility primarily used by system shutdown and reboot scripts in SysV-style init systems. It sends a specified signal (defaulting to SIGTERM) to every process on the system, with key exceptions: it spares process ID 1 (init or systemd in legacy contexts), processes explicitly listed via the -o option, and sometimes processes owned by or parented to init. This design ensures the system can cleanly halt without self-terminating the shutdown initiator.

Invoked automatically during runlevel changes or shutdown, killall5 facilitates orderly process termination. First, it issues SIGTERM for graceful exits; unresponsive processes may receive SIGKILL later via other mechanisms. Manual use is rare and risky, as it can freeze unresponsive systems or cause data loss if not all processes cooperate.

Root privileges are required, often via setuid. It's part of packages like sysvinit-utils on Debian-based systems. In modern Linux with systemd, its role persists in compatibility modes but is less central. Understanding killall5 aids troubleshooting boot/shutdown issues or init system internals.

CAVEATS

Extremely dangerous for manual use; can hang system if processes ignore signals. Requires root. Avoid on live systems outside shutdown contexts.

KEY EXCEPTIONS

Always skips PID 1 (init). Omits user-specified PIDs. May spare init-owned processes depending on implementation.

TYPICAL INVOCATION

shutdown calls it as killall5 -15 (SIGTERM) during halt.

HISTORY

Developed as part of SysV init (AT&T Unix, 1980s); integrated into Linux sysvinit by Miquel van Smoorenburg (1991). Persists in modern distros for legacy support despite systemd prevalence.

SEE ALSO

shutdown(8), reboot(8), killall(1), kill(1), telinit(8)

Copied to clipboard