procutils-killall 0.2.0

Kill processes by name
Documentation

killall

Kill processes by name.

Description

Sends a signal (default SIGTERM) to every process whose command name matches one of the given arguments. Names are matched against the kernel's comm field, which the kernel truncates to 15 characters (TASK_COMM_LEN).

Compared to pkill, killall matches names exactly rather than via regular expression. Multiple names may be given; each is processed independently.

Inputs

  • /proc/[pid]/stat -- process command name (comm)
  • /proc/[pid]/status -- process owner UID (used by -u)
  • /etc/passwd -- username-to-UID resolution (used by -u)

Arguments

Argument Description
name... (positional) Process names to signal
-s SIGNAL, --signal SIGNAL Signal to send (name or number); defaults to TERM
-SIG, -NAME, -NUM Shorthand for -s SIG (e.g. -9, -HUP)
-I, --ignore-case Case-insensitive name match
-u USER, --user USER Match only processes owned by USER
-l, --list List supported signal names and exit
-q, --quiet Suppress the "no process found" diagnostic
-v, --verbose Print a line for each signalled process

Behavior

For each name, walks /proc, finds processes whose comm matches exactly (case-sensitively unless -I), and sends the chosen signal to each. The diagnostic <name>: no process found is printed to stderr when a name has zero matches (suppressed with -q).

Exit codes

Code Meaning
0 Every name matched at least one process and all signals were delivered
1 At least one name matched no process, or a signal could not be delivered
2 Invalid arguments (unknown signal, no names given, etc.)

Divergences from psmisc

The following options are not yet implemented: -e/--exact (long-name matching), -r/--regexp (regex patterns — use pkill), -i/--interactive, -w/--wait, -g/--process-group, -y/--younger-than, -o/--older-than, -Z/--context (SELinux), -n/--ns (namespace).

Because matching is always against the truncated comm, processes whose binary name is longer than 15 characters can only be matched by their truncated form.