Linux killall Command: Signal Processes by Name

Linux's killall sends signals to processes that match the specified name. The default is SIGTERM, and if there are multiple processes with the same name, they can all be targeted.

What is the killall command?

This explanation is based on the common psmisc implementation in Linux. The meaning of killall can be different in other Unix variants, so always check the current manual when moving between systems. Target selection is first reviewed with pgrep.

Basic syntax

killall [option] name...

Installed implementations and options may vary depending on the distribution. Check the current system description with man killall.

Examples

Checking for processes with the same name

First, look at the PID and command line of the intended name.

pgrep -a -x myworker

Requesting normal termination

In the Linux psmisc implementation, SIGTERM is sent to jobs whose names match.

killall -TERM myworker

Target name and user restrictions

Use this when you need to reduce the user scope.

killall -u alice myworker

When there are multiple processes with the same name

killall can send a signal to all processes that match the specified name. You should first check the candidates with pgrep to avoid terminating unexpected instances.

pgrep -a -x demo-worker
killall -TERM demo-worker

The first command shows the target PID and command line, while the second command usually does not output anything even if successful. After that, check the remaining processes with pgrep -a -x demo-worker. If there are multiple processes with the same name, they can all be affected.

Replace the example name with the test process you created. Some Unix-based killall implementations behave differently from Linux, so do not assume portability. If the target is a service, using systemctl stop service-name may be more appropriate than directly terminating the process.

Main Options and Format

Options/Format Description
-s signal Specifies the signal to send.
-u user Selects only the processes of the specified user.
-i Prompts for confirmation for each target.
-v Displays detailed execution information.
-w Waits until the matched processes terminate.

Precautions when using

Be especially careful on shared servers, as using only the name may affect all processes with the same name. -w may wait a long time for processes that do not terminate. The behavior of killall on other operating systems may differ, so do not confuse it with the Linux psmisc implementation.

Frequently Asked Questions

Does killall terminate all processes on the system?

In the Linux psmisc implementation, it targets processes that match the specified name. However, in other Unix implementations, the meaning can be different.

Official Documentation

The exact behavior of the options and implementation differences can be found in the official killall documentation.

More in This Category
Linux Tutorial / Standard Input, Output, Redirection, and Pipes

Linux Tutorial / Standard Input, Output, Redirection, and Pipes

Understand standard input, output, and error; practice file redirection and pipes; and learn why overwrite risk and redirection order matter.

Linux Tutorial / Understand systemd Services, Boot, and Logs

Linux Tutorial / Understand systemd Services, Boot, and Logs

Understand Linux boot stages and systemd units, distinguish active services from boot enablement, and inspect current-boot logs with systemctl and journalctl.

Linux Tutorial / How the Shell Runs Commands: ;, &&, ||, Aliases, and Environment Variables

Linux Tutorial / How the Shell Runs Commands: ;, &&, ||, Aliases, and Environment Variables

Learn how Bash resolves commands and uses exit status with ;, &&, and ||, then distinguish aliases, shell variables, and exported environment variables.

Linux gunzip Command: Decompress gzip Files

Linux gunzip Command: Decompress gzip Files

Learn how to decompress gzip Files with the Linux gunzip command, including practical examples, key options, and important precautions.

Linux killall Command: Signal Processes by Name

Linux killall Command: Signal Processes by Name

Learn how to signal Processes by Name with the Linux killall command, including practical examples, key options, and important precautions.

Linux unalias Command: Remove Command Aliases

Linux unalias Command: Remove Command Aliases

Learn how to use the Linux unalias command to remove one or all aliases from the current shell session, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux fg Command: Bring a Shell Job to the Foreground

Linux fg Command: Bring a Shell Job to the Foreground

Learn how to bring a Shell Job to the Foreground with the Linux fg command, including practical examples, key options, and important precautions.

Linux su Command: Switch User Accounts and Login Shells

Linux su Command: Switch User Accounts and Login Shells

Learn how to use the Linux su command to switch user accounts and start login or non-login shells, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Bash Command Operators Explained: ;, &&, ||, &, and |

Bash Command Operators Explained: ;, &&, ||, &, and |

Understand how Bash operators run commands sequentially, conditionally, in the background, or through pipelines, with practical examples and precedence guidance.

Linux bunzip2 Command: Decompress bzip2 Files

Linux bunzip2 Command: Decompress bzip2 Files

Learn how to decompress bzip2 Files with the Linux bunzip2 command, including practical examples, key options, and important precautions.