killall Command in Linux: Kill Processes by Name

By 

Published on

8 min read

Terminating processes by name with the killall command in a Linux terminal

When a program misbehaves, it may leave several processes running. Modern browsers start separate worker processes, and a stuck script may have been launched several times in different terminals. Killing each one with the kill command means looking up every PID first. The killall command skips that step: you give it a process name, and it signals every process running under that name.

This guide explains how to use killall to terminate processes by name, choose the signal to send, and narrow matches by user, age, or pattern.

Installing killall

killall is part of the psmisc package, which is preinstalled on most desktop and server distributions. If the command is missing, install it from the standard repositories.

On Ubuntu, Debian, and Derivatives:

Terminal
sudo apt install psmisc

On Fedora, RHEL, and Derivatives:

Terminal
sudo dnf install psmisc
Warning
On Linux, the psmisc version of killall affects only processes matching the given name. On some other Unix systems, such as Solaris and AIX, killall signals nearly every process on the machine, which is how those systems tear things down at shutdown. Confirm which implementation is installed before running killall on a remote system, especially as root.

killall Syntax

The general syntax of the killall command is as follows:

txt
killall [OPTIONS] NAME...

NAME is the process name to match. You can pass more than one name, and killall signals every process that matches any of them. Unlike pkill, which matches partial names, killall requires the name to match exactly.

killall exits with status zero when it successfully signals at least one process for every name you supplied. If a name does not match, it prints a message and returns a non-zero status:

Terminal
killall firefox
output
firefox: no process found

Killing a Process by Name

To terminate a process, pass its exact name:

Terminal
killall firefox

By default, killall sends the SIGTERM signal, which asks each matching process to shut down cleanly. The command produces no output when it succeeds. Add -v to confirm what was signalled:

Terminal
killall -v vlc
output
Killed vlc(8143) with signal 15

The output shows the process name, its PID, and the signal number. Signal 15 is SIGTERM.

Before sending a signal, use pgrep to preview exact matches and their full command lines:

Terminal
pgrep -a -x firefox

If this command prints nothing, check ps -e -o pid,comm to find the process name that Linux reports.

Sending a Specific Signal

When a process ignores SIGTERM, you can send a stronger signal. The -s option accepts a signal name or number:

Terminal
killall -s KILL myscript

SIGKILL cannot be caught or ignored, so the process is terminated immediately without a chance to clean up. The same signal can be written in two shorter forms:

Terminal
killall -9 myscript
killall -SIGKILL myscript

Use SIGKILL only after a plain killall has failed. A process killed this way cannot flush buffers or remove its temporary files, which is why trying SIGTERM first is the safer habit. For a longer discussion of signals and when to use each, see our guide on how to kill a process in Linux .

Signals are also useful for more than termination. For example, BIND reloads its configuration when the named process receives SIGHUP:

Terminal
sudo killall -s HUP named

To list all signal names that killall understands, use -l:

Terminal
killall -l
output
HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT
CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH POLL PWR SYS

Matching Names Case-Insensitively

Process name matching is case-sensitive by default. If you are not sure about the capitalization, add -I:

Terminal
killall -I "teamviewer"

This matches TeamViewer, teamviewer, and any other case variant of the name.

Matching with Regular Expressions

The -r option interprets the name as an extended regular expression, so you can signal several related processes at once:

Terminal
killall -r '^chrom.*'

The ^ anchor limits the match to names that begin with chrom, such as chrome and chromium. Quote the pattern so the shell does not interpret special characters before killall sees them.

Killing Processes Owned by a User

The -u option restricts matches to processes owned by a specific user:

Terminal
killall -u sarah node

This terminates only the node processes running under the sarah account, leaving other users’ node processes alone.

If you pass -u without a process name, killall signals every process the user owns:

Terminal
sudo killall -u sarah

Be careful with this form. It terminates the user’s entire session, including their shell and any editors with unsaved work. Combine it with -i when you want to review each process first.

Confirming Each Kill Interactively

The -i option asks for confirmation before signalling each matching process:

Terminal
killall -i node
output
Kill node(2211) ? (y/N)
Kill node(2384) ? (y/N)

Answer y to signal a process or press Enter to skip it. Interactive mode is a good safety net when a name is common enough to match processes you did not have in mind.

Filtering by Process Age

The -o (older) and -y (younger) options filter matches by how long a process has been running. The time is a whole number followed by a unit: s for seconds, m for minutes, h for hours, d for days, w for weeks, M for months, and y for years.

To kill myscript processes that have been running for more than an hour:

Terminal
killall -o 1h myscript

To kill only instances started within the last ten minutes:

Terminal
killall -y 10m myscript

The age filters are handy for cleaning up stuck workers or runaway cron jobs while leaving fresh, healthy instances running.

Waiting for Processes to Die

By default, killall sends the signal and returns immediately. The -w option makes it wait until all signalled processes have actually terminated:

Terminal
killall -w myscript && echo "all stopped"

This is useful in scripts that must not continue until a service is fully down. The wait can continue forever if the signal is ignored, has no effect, or leaves the process in a zombie state.

To put a ten-second limit on the wait, run killall through the timeout command :

Terminal
timeout 10s killall -w myscript

If the limit expires, timeout stops the killall command, but the target process may still be running. Inspect it with pgrep before deciding whether to send SIGKILL. A process that remains in a zombie state can also cause killall -w to keep waiting.

killall vs kill vs pkill

All three commands send signals; they differ in how you select the target processes:

  • kill targets a specific PID. It is the most precise option, but you have to look the PID up first.
  • killall targets an exact process name and signals every instance of it.
  • pkill targets a name pattern, so pkill fire matches firefox. It can also match against the full command line with -f.

The exact-name behavior of killall makes it more predictable than pkill for everyday use: killall node cannot accidentally match node_exporter. Linux limits the process name stored in /proc/PID/stat to 15 characters. For longer names, killall may have to fall back to those first 15 characters when the full name is unavailable. Add -e to skip a long-name match that cannot be verified exactly.

Common Options

  • -s SIGNAL - Send the given signal instead of SIGTERM. Also accepts the -SIGNAL and numeric forms.
  • -l - List known signal names.
  • -v - Report each signal that was successfully sent.
  • -q - Do not complain when no process matched.
  • -I - Match process names case-insensitively.
  • -r - Interpret the name as an extended regular expression.
  • -e - Require an exact match for names longer than 15 characters.
  • -u USER - Match only processes owned by the given user.
  • -i - Ask for confirmation before signalling each process.
  • -o TIME - Match only processes older than the given age.
  • -y TIME - Match only processes younger than the given age.
  • -w - Wait until all signalled processes have died.

Quick Reference

For a printable quick reference, see the kill cheatsheet .

TaskCommand
Terminate all processes with a namekillall firefox
Force kill after a failed terminatekillall -9 firefox
Reload BIND’s configurationsudo killall -s HUP named
Ignore name capitalizationkillall -I teamviewer
Match names by regexkillall -r '^chrom.*'
Kill a user’s instances of a programkillall -u sarah node
Kill all of a user’s processessudo killall -u sarah
Confirm each killkillall -i node
Kill instances older than one hourkillall -o 1h myscript
Wait until processes exitkillall -w myscript
List signal nameskillall -l

Troubleshooting

killall: no process found
killall requires the process name to match exactly unless you use -r or -I. Run pgrep -a pattern or ps -e -o pid,comm to check the reported name, capitalization, and command line before trying again.

Operation not permitted
You can signal your own processes, but another user’s process normally requires root privileges. Verify the exact target first, then rerun the command with sudo only when needed.

killall -w does not return
The process may have ignored the signal, stayed in a zombie state, or been replaced by a new process with the same PID while killall was checking it. Stop waiting with Ctrl+C, inspect the target with pgrep -a -x NAME, and use SIGKILL only if the process is still running and cannot shut down cleanly.

Conclusion

killall terminates every instance of a program in one command, with filters for user, age, and case when the name alone is too broad. When you need pattern matching instead of exact names, reach for pkill , and when you need to inspect processes before killing them, start with pgrep .

Linuxize Weekly Newsletter

A quick weekly roundup of new tutorials, news, and tips.

About the authors

Dejan Panovski

Dejan Panovski

Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.

View author page