killall is a Linux command-line utility that sends a signal to all processes matching a name, rather than to a single process ID. Within the Processes topic of Linux administration, it is the quickest way to stop, reload or inspect every running instance of one program with a single command.
On Linux, killall comes from the psmisc package and matches processes by their command name by default. It sends SIGTERM unless another signal is requested, which makes it a name-based counterpart to kill and a stricter, more predictable relative of pkill.
How killall selects and signals processes
killall works by scanning the process table exposed in /proc, comparing each process name with the argument, and delivering the chosen Unix signal to every match. The command name it compares is the short name stored in /proc/PID/stat, which the kernel truncates to 15 characters.
Because the short name can be ambiguous, killall falls back to the full executable path when a name is longer than 15 characters and a match would otherwise be uncertain. When the argument contains a slash, such as /usr/sbin/nginx, killall matches only processes running that exact file, which is the safest way to target a specific binary.
The sequence below shows what happens during a typical invocation, from parsing the arguments to reporting the result through the exit status.
| Stage | What killall does | Relevant detail |
|---|---|---|
| Parse arguments | Reads names, signal and filters | Default signal is SIGTERM |
| Read process table | Walks every directory in /proc | Requires readable process entries |
| Match names | Compares the command name or path | Exact match unless -r is used |
| Apply filters | Checks user, age and terminal options | Options -u, -o, -y narrow the set |
| Deliver signal | Calls kill() for each matched PID | Permission errors are reported |
| Report result | Returns exit status 0 or 1 | 1 means no process was killed |
Key killall options and signals
The most useful killall options narrow the selection or change the signal, and knowing them prevents accidental termination of unrelated processes. The signal is given as -s NAME, -SIGNAL or a number, and killall -l lists all signal names the system supports.
| Option | Effect | Typical use |
|---|---|---|
| -s or -SIGNAL | Sends the named signal | Reload a daemon with HUP |
| -i | Asks for confirmation per process | Interactive cleanup on shared hosts |
| -u user | Matches only that user’s processes | Stop one account’s sessions |
| -e | Requires an exact long-name match | Avoid 15-character ambiguity |
| -I | Ignores case in names | Inconsistent program naming |
| -r | Treats the name as a regular expression | Match a family of workers |
| -o and -y | Selects processes older or younger than a time | Kill only stale instances |
| -w | Waits until all matched processes exit | Scripts that restart a service |
| -q | Suppresses messages when nothing matches | Quiet automation |
The choice of signal decides whether the program can clean up. SIGTERM and SIGHUP can be caught and handled, while SIGKILL cannot be caught or ignored, so the kernel removes the process immediately without flushing buffers or deleting lock files.
| Signal | Number | Typical meaning | Can be handled |
|---|---|---|---|
| SIGTERM | 15 | Request a graceful shutdown | Yes |
| SIGHUP | 1 | Reload configuration in many daemons | Yes |
| SIGINT | 2 | Interrupt, as with Ctrl+C | Yes |
| SIGKILL | 9 | Terminate immediately | No |
| SIGSTOP | 19 | Pause execution | No |
| SIGCONT | 18 | Resume a paused process | Yes |
killall compared with kill and pkill
killall differs from kill and pkill mainly in how it identifies targets: kill needs process IDs, pkill matches a pattern anywhere in the name, and killall requires an exact name match by default. That strictness makes killall less likely to hit an unintended process whose name merely contains the search string.
| Command | Selects processes by | Default matching | Source package |
|---|---|---|---|
| kill | Process ID or job number | No name matching | util-linux or shell built-in |
| pkill | Name, user, group or full command line | Regular expression substring | procps-ng |
| killall | Command name or executable path | Exact name | psmisc |
| pgrep | Same criteria as pkill | Regular expression substring | procps-ng |
A practical rule follows from this: use kill when the PID is known, killall when every instance of a named program must receive the same signal, and pkill when the match depends on command-line arguments. A dry run with pgrep or killall -i is a sensible check before a destructive signal.
Portability and the Solaris pitfall
killall is not portable across Unix systems, and the difference is serious. On Solaris and some older System V derivatives, a command named killall terminates all active processes as part of the shutdown sequence, so running a Linux habit there can stop an entire server.
Even among Linux distributions the tool may be absent from minimal container images, where psmisc is often not installed. Scripts intended to run in many environments therefore check for the command or prefer pkill, which ships with the more widely installed procps-ng package.
Common mistakes when using killall
Most killall problems arise from matching the wrong set of processes or from using an overly forceful signal. The table lists frequent symptoms with their usual causes and remedies.
| Symptom | Likely cause | Fix |
|---|---|---|
| No process found | Name differs from the visible title | Check the real name with ps -e |
| Long name does not match | Kernel truncates names to 15 characters | Use -e or the full path |
| Operation not permitted | Processes belong to another user | Run with sufficient privileges |
| Data or lock files left behind | SIGKILL used as the first choice | Send SIGTERM and wait first |
| Unrelated sessions closed | Shared program name across users | Add -u to limit the scope |
| Process survives SIGKILL | Uninterruptible sleep or zombie state | Fix the I/O wait or the parent |
- Escalate gradually: send SIGTERM, wait a few seconds, and use SIGKILL only for processes that remain.
- Zombie processes cannot be killed because they have already exited; the parent must reap them, or the parent itself must end.
- Avoid running killall as root casually, because it then matches the processes of every user on the system.
- Prefer service managers such as systemctl for managed daemons, so that restart policies and dependencies stay consistent.
Explained without jargon
Every program running on a Linux computer is a process, and each one has a name. killall lets an administrator address all processes with the same name at once, much like calling everyone named Alex in a crowded room instead of tapping each person on the shoulder.
Usually the message is a polite request to finish up and leave, which gives the program time to save its work. If a program refuses to respond, a much stronger message can remove it instantly. The key takeaway is simple: killall is fast and convenient, so it is worth checking exactly which programs share that name before using it.
A typical use case
A systems administrator manages a web server where a deployment script has left twelve stalled worker processes named report-worker, each holding about 400 MB of memory. Restarting the whole machine would interrupt the web service, so the administrator first lists the workers with pgrep -l report-worker and confirms that all of them belong to the app account.
The administrator then runs killall -u app -w report-worker, which sends SIGTERM to every matching worker and waits until they exit. Ten processes stop within two seconds; two remain stuck. A follow-up killall -u app -9 report-worker removes them. The result is roughly 4.8 GB of memory recovered with no interruption to the web service, and the job scheduler starts fresh workers on its next cycle.