Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

killall Command Guide for Killing by Name

This guide helps you understand and use the killall command, which stops every process running a given program name — no PID hunting required.


What is killall, and Why Use It?

The killall command sends a signal to all processes matching a name. Instead of finding each process ID with ps and passing them one by one to kill, you say the program’s name and killall finds and signals every instance. It is the shortest path from “stop nginx” to “nginx stopped” when the program name is exact and unique.

Why Learn killall?

  • Speed: One command instead of find-then-kill for programs with many instances.
  • Safety of name matching: It matches the exact executable name, not a substring of the whole command line.
  • Signals work too: killall -HUP reloads a daemon’s config the same way kill -HUP does.

killall is kill with the addressing built in: you name the target, and it finds every instance.


1. Kill All Instances of a Program

killall firefox
  • Every process named exactly firefox receives SIGTERM (15);
  • The command prints nothing on success — silence means every target was signalled;
  • Verify with ps or pgrep that nothing remains.

2. Choose a Specific Signal

killall -9 firefox        # force-kill
killall -HUP nginx        # ask nginx to reload its config
  • -9 sends SIGKILL when a program refuses to exit;
  • -HUP (SIGHUP) asks daemons to reread their configuration;
  • The signal rules are the same as in kill — killall -l lists them.

3. Match Only Running-or-Exact Names

killall -e firefox        # require an exact name match
killall -i firefox        # ask for confirmation before killing
  • -e makes matching strict — useful when a longer name could accidentally match;
  • -i prompts before each kill, a guard against typos;
  • -v (verbose) prints each process it signals, useful for confirming what happened.

4. Wait for Processes to Finish

killall -w firefox
  • -w waits until all signalled processes have actually exited;
  • Useful in scripts that must be sure the old instance is gone before starting a new one;
  • Combine with a timeout wrapper if the process might hang.

Common Pitfalls

  • Expecting pattern matching: killall matches the whole executable name, not substrings. killall pyth will not find python3 — that is pkill’s job.
  • Killing by the wrong name: Check the exact name with pgrep -l firefox first; killall on a wrong name silently does nothing.
  • Assuming it kills children: killall signals the processes you name, not their children — a killed parent may leave orphaned workers behind.
  • Reaching for -9 by reflex: Give SIGTERM a chance first; see kill for when escalation is appropriate.

PageDescription
killThe signal-sending foundation
pkillKill by pattern, with richer matching options
pgrepFind the PIDs (and names) killall would target
psVerify what is still running

killall Cheatsheet

TaskCommand
Kill every instance by namekillall firefox
Force-killkillall -9 firefox
Reload a daemon’s configkillall -HUP nginx
Strict exact-name matchkillall -e name
Confirm before killingkillall -i name
Verbose outputkillall -v name
Wait for exitkillall -w name
List signalskillall -l