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 hostnamectl Command: Show and Change the Host Name

Linux hostnamectl Command: Show and Change the Host Name

Learn how to show and Change the Host Name with the Linux hostnamectl command, including practical examples, key options, and important precautions.

Linux locate Command: Search Indexed File Paths Quickly

Linux locate Command: Search Indexed File Paths Quickly

Learn how Linux locate searches a filename database, how updatedb affects freshness, how to limit and filter matches, and when find is the better tool.

Linux fmt Command: Reformat Plain-Text Paragraphs

Linux fmt Command: Reformat Plain-Text Paragraphs

Learn how to reformat Plain-Text Paragraphs with the Linux fmt command, including practical examples, key options, and important precautions.

Linux scp Command: Copy Files over SSH

Linux scp Command: Copy Files over SSH

Learn how to copy Files over SSH with the Linux scp command, including practical examples, key options, and important precautions.

Linux chgrp Command: Change a File's Group

Linux chgrp Command: Change a File's Group

Learn how to change a File's Group with the Linux chgrp command, including practical examples, key options, and important precautions.

Linux free Command: Check Memory and Swap Usage

Linux free Command: Check Memory and Swap Usage

Learn how to use the Linux free command to inspect available memory, used memory, cache, and swap usage, with essential options, practical examples, output interpretation, and common troubleshooting tips.

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.

Linux install Command: Copy Files and Set Attributes

Linux install Command: Copy Files and Set Attributes

Learn how to use the Linux install command to copy files while setting modes, owners, groups, timestamps, and destination directories in deployment scripts.

Linux fold Command: Wrap Long Lines at a Fixed Width

Linux fold Command: Wrap Long Lines at a Fixed Width

Learn how to wrap Long Lines at a Fixed Width with the Linux fold command, including practical examples, key options, and important precautions.

Linux Tutorial / Inspect, Pause, and Stop Processes

Linux Tutorial / Inspect, Pause, and Stop Processes

Inspect Linux processes with ps, top, and pgrep, then safely pause, resume, and terminate a practice process while distinguishing shell jobs from services.