Operations 8 min read

Mastering killall: 8 Practical Ways to Terminate Linux Processes

This guide explains eight useful killall command techniques for Linux, covering basic termination, user‑wide kills, time‑based filters, case‑insensitive matching, silent mode, signal listing, interactive confirmation, and waiting for process exit, with clear examples and code snippets.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Mastering killall: 8 Practical Ways to Terminate Linux Processes

1. Basic usage

If three processes named hello1, hello2 and hello3 are running, you can terminate hello1 with a simple command: killall hello1 The process disappears from the process list, confirming the termination.

2. Killing all processes of a specific user

To stop every process started by user harry, use the -u option. This sends the default SIGTERM signal to each of the user’s processes. killall -u harry Be cautious: this also terminates the user’s login shells, which may log the user out.

3. Terminating processes based on runtime

Use -o (older) to kill processes that have been running longer than a specified period, e.g., five hours: killall -o 5h Conversely, -y (younger) kills processes that have run for less than the given time, such as four hours: killall -y 4h Both options are aggressive and may also close the terminal.

4. Ignoring case

By default, killall matches case‑sensitively. Adding -I makes the match case‑insensitive:

killall -I HELLO1

5. Suppressing output

To run the command silently, add the -q (quiet) flag:

killall -q HELLO2

6. Listing and sending specific signals

Use -l to list all signals supported by killall: killall -l To send a particular signal, use -s followed by the signal name, e.g., killall -s KILL processname.

7. Interactive mode

If you want to confirm each termination, add -i. The command will prompt you for each matching process:

killall -i hello*

8. Waiting for termination

The -w (wait) option makes killall pause until the targeted process has fully exited before returning control: killall -w hello1 This can be useful in scripts where subsequent actions depend on the process being completely stopped.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

command-lineSysadminkillall
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.