killall Command: Kill Processes by Name, the -9 Signal, and Installing psmisc
The killall command is a Linux command that picks running processes by program name instead of process number (PID) and sends them a signal; if you don't specify a signal, it sends SIGTERM (per the official manual). Because it ends every process with the same name at once, we first checked with pgrep and ps four processes started on an AlmaLinux 9 server from copies of sleep under different names, and for an executable longer than 15 characters, only the first 15 characters remained in the process name.
We ran killall only on xxsleep processes started for testing under a regular account on a Debian 12 server. The result boxes show rpm, pgrep, ps, pidof, cat, and kill output run as root on an AlmaLinux 9.8 server, and killall output run on the Debian 12 server. Process numbers (PIDs), process names, executable paths, and account names have been replaced with example values.
1️⃣ Installing the killall command
killall is part of the psmisc package. On an AlmaLinux 9.8 server, checking with rpm which package /usr/bin/killall belongs to showed version psmisc 23.4.
rpm -qf --qf '%{NAME} %{VERSION}\n' /usr/bin/killallpsmisc 23.4The file list of the same package, viewed with rpm -ql, also included pstree and fuser.
If you get [command not found], meaning the command can't be found, install the psmisc package. On the RHEL family it's [dnf install psmisc], and on the Debian family it's [apt install psmisc]. The Debian 12 server already had psmisc 23.6 installed, and killall was at /usr/bin/killall.
Checking on the AlmaLinux 9.8 server, the similarly named pkill was in the procps-ng package, and kill was a shell built-in command.
2️⃣ How to use the killall command
The basic form is [killall process name]. It finds every running process with the given name and sends it a signal; if you give several names, it does the same for each name (per the official manual).
Because processes with the same name all end at once, first check with pgrep what is running under that name. We copied sleep into a working folder under the names xxsleep-a1, xxsleep-a2, and xxsleep-longname-x1, started xxsleep-a1 twice for four processes in total, and printed numbers and names with -l.
pgrep -l xxsleep2141 xxsleep-a1
2142 xxsleep-a1
2150 xxsleep-a2
2155 xxsleep-longnamThe fourth line's executable is named xxsleep-longname-x1, but the process name was cut off at xxsleep-longnam.
Adding -a shows the whole command line that was run. The two xxsleep-a1 processes with the same name were told apart by the trailing seconds argument, 300 and 310.
pgrep -a xxsleep2141 /root/work/xxsleep-a1 300
2142 /root/work/xxsleep-a1 310
2150 /root/work/xxsleep-a2 320
2155 /root/work/xxsleep-longname-x1 330To find only processes whose name matches exactly, add -x. The result for xxsleep-a1 was two numbers.
pgrep -x xxsleep-a12141
2142To check only the numbers by entering one name as is, use pidof. Searching for xxsleep-a1 printed both numbers on one line.
pidof xxsleep-a12142 2141ps prints only processes whose name matches exactly when you list several names after -C, separated by commas.
ps -o pid,comm -C xxsleep-a1,xxsleep-a2 PID COMMAND
2141 xxsleep-a1
2142 xxsleep-a1
2150 xxsleep-a2On the Debian 12 server, we started four processes under the same names and ran [killall xxsleep-a1]; it printed nothing and finished with exit code 0. Searching again with pgrep, both xxsleep-a1 processes were gone, and only xxsleep-a2 and xxsleep-longname-x1 remained. If you give a path containing a slash (/) instead of a name, it picks processes running that file regardless of their name (per the official manual).
Giving the nonexistent name xxsleep-zz printed a line with [no process found] after the name and finished with exit code 1. The exit code is 0 only when at least one process was ended for each name given (per the official manual).
killall xxsleep-zzxxsleep-zz: no process foundTo end just one process whose number you know, use the Linux kill command to send a signal to that number only.
3️⃣ killall command options
Reading the name of the process started as xxsleep-longname-x1 from /proc/PID/comm showed only the first 15 characters, xxsleep-longnam.
cat /proc/2155/commxxsleep-longnamWe ran pgrep with the 16-character xxsleep-longname.
pgrep -a xxsleep-longnameIt finished with no output and exit code 1, and searching again with the 15-character xxsleep-longnam showed that process.
pgrep -l xxsleep-longnam2155 xxsleep-longnamWhen killall gets a name longer than 15 characters and there are processes whose full name it can't read, it targets every process whose first 15 characters match; adding -e skips those entries (per the official manual). On the Debian 12 server, giving the 15-character xxsleep-longnam with -e and -v printed lines saying it skipped three other processes whose names were cut at 15 characters, and it ended with [no process found].
killall -e -v xxsleep-longnamkillall: skipping partial match quota_events_un(37)
killall: skipping partial match acpi_thermal_pm(112)
killall: skipping partial match ext4-rsv-conver(246)
xxsleep-longnam: no process foundGiving the full name xxsleep-longname-x1 printed the same skip lines, followed by a line showing the signal sent to that process.
killall -e -v xxsleep-longname-x1killall: skipping partial match quota_events_un(37)
killall: skipping partial match acpi_thermal_pm(112)
killall: skipping partial match ext4-rsv-conver(246)
Killed xxsleep-longname-x1(2155) with signal 15With -v, a line containing the name, number, and signal number appeared for each process that was sent a signal.
killall -v xxsleep-a2Killed xxsleep-a2(2150) with signal 15-i asks for each process whether to end it. We started two xxsleep-a1 processes again and fed y and n in turn through standard input; the two prompts appeared joined on one line, and only the first xxsleep-a1 ended while the second remained.
printf 'y\nn\n' | killall -i xxsleep-a1Kill xxsleep-a1(2171) ? (y/N) Kill xxsleep-a1(2172) ? (y/N)-u picks only processes owned by that account, and if you omit the name, all of that account's processes are targeted. Giving xxsleep-a1 after the account name sent a signal only to the remaining xxsleep-a1.
killall -v -u user xxsleep-a1Killed xxsleep-a1(2172) with signal 15-o and -y select by start time, and the time is written as a number followed by a unit s, m, h, d, w, M, or y, as in [-o 30m].
-r reads names as extended regular expressions. Passing the pattern ^xxsleep-a to pgrep showed three processes starting with xxsleep-a.
pgrep -l '^xxsleep-a'2141 xxsleep-a1
2142 xxsleep-a1
2150 xxsleep-a2-w waits, checking every second, until all processes that were sent a signal are gone. If a process ignores the signal or remains as a zombie, it may wait forever.
The first table below lists the check commands and killall options actually run in this post, and the killall options not run are collected in the second table based on the official manual.
📌 Checking processes and killall: results from this post
| Command | Task | Result in this article | |
|---|---|---|---|
| pgrep -l name | Number and name of processes whose name contains it | Four lines for xxsleep; the long name shows only its first 15 characters, xxsleep-longnam | |
| pgrep -a name | Number and the whole command line | The two xxsleep-a1 processes told apart by the trailing arguments 300 and 310 | |
| pgrep -x name | Only the numbers of processes whose name matches exactly | Two lines for xxsleep-a1: 2141 and 2142 | |
| pidof name | Numbers running under that name, on one line | 2142 2141 for xxsleep-a1 | |
| ps -o pid,comm -C name | Number and name of processes whose name matches exactly; several names separated by commas | Two xxsleep-a1 lines and one xxsleep-a2 line | |
| cat /proc/PID/comm | Process name (up to the first 15 characters) | 2155 is xxsleep-longnam | |
| killall name | SIGTERM to processes with that name | Both xxsleep-a1 processes ended with exit code 0; the nonexistent name xxsleep-zz gave no process found and exit code 1 | |
| killall -e name | Names longer than 15 characters only when the full name matches | xxsleep-longnam gave no process found; xxsleep-longname-x1 ended | |
| killall -v name | Prints a result for each process sent a signal | Killed xxsleep-a2(2150) with signal 15 | |
| killall -i name | Asks for each process before ending it | Entering y and n ended only the first xxsleep-a1 | |
| killall -u account name | Only processes owned by that account | Given with a name, only that account's xxsleep-a1 ended | |
| killall -9 name | SIGKILL instead of SIGTERM | Killed xxsleep-a2(2173) with signal 9 |
📎 Other options: per the official manual
| Option | Task | |
|---|---|---|
| -I, --ignore-case | Compare names case-insensitively | |
| -g, --process-group | Signal the process group instead of the process (once per group) | |
| -l, --list | List known signal names | |
| -n, --ns PID | Only processes in the same PID namespace as that PID; by default, all namespaces | |
| -o, --older-than time | Only processes started earlier than that time (units s, m, h, d, w, M, y) | |
| -q, --quiet | Don't complain if no process was ended | |
| -r, --regexp | Read names as extended regular expressions | |
| -s, --signal signal | Signal to send instead of SIGTERM | |
| -V, --version | Print version information | |
| -w, --wait | Wait until all processes sent a signal are gone | |
| -y, --younger-than time | Only processes started later than that time | |
| -Z, --context pattern | Only processes whose security context matches the extended regex pattern; given before other arguments; the name can be omitted |
🔲 killall command simulator
The simulator below starts with a list of the four xxsleep processes plus xxsleep-a2 of the example account user1. Tap the chips to compare which lines disappear from the list with [killall -v], [-i], and [-u]; the killall output text mimics the output from running it on the Debian 12 server.
4️⃣ killall signals
Specify the signal to send by name, as in [-HUP] or [-SIGHUP], by number, as in [-1], or after the -s option (per the official manual). [killall -9 process name] sends signal 9, SIGKILL. SIGKILL is a signal a process can't catch or ignore (per the official manual), so the process ends without doing any cleanup. That's why you send it when the default signal, SIGTERM, doesn't end the process.
On the Debian 12 server, adding -9 together with -v to xxsleep-a2, started again, printed a line showing signal number 9.
killall -9 -v xxsleep-a2Killed xxsleep-a2(2173) with signal 9We checked signal names and numbers with [kill -l]. killall also has an -l option that prints the signal names it knows.
kill -l 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP
6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1
11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM
16) SIGSTKFLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP
21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ
26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO 30) SIGPWR
31) SIGSYS 34) SIGRTMIN 35) SIGRTMIN+1 36) SIGRTMIN+2 37) SIGRTMIN+3
38) SIGRTMIN+4 39) SIGRTMIN+5 40) SIGRTMIN+6 41) SIGRTMIN+7 42) SIGRTMIN+8
43) SIGRTMIN+9 44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13
48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12
53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-7
58) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2
63) SIGRTMAX-1 64) SIGRTMAXEntering a single number printed only that signal's name. The 15 that killall sends by default was TERM, and the 9 sent with -9 was KILL.
kill -l 15TERMkill -l 9KILLIf you give a signal name that isn't in the list, a message of the form [FOO: unknown signal; killall -l lists signals.] appears (per the official manual and program text).
🔢 FAQ & Recommended Content
Real-time check
Linux top Command (Checking CPU and Memory Usage)
A command that shows in real time how much CPU and memory each process uses.
Job control
Linux Background and Foreground: Controlling Processes
How to control jobs by sending a command to the background and bringing it back to the foreground.
Open files
[Linux] lsof Command: Print Information on Files in Use
A command that shows the files and sockets a process has open, along with its PID.
ℹ️ Affiliate Disclosure
This site's content contains affiliate links. When a visitor buys a product or service through one of them, the site receives a commission from the seller. The amount the buyer pays(it goes down during event discounts ↓)does not go up. Posted prices, discounts, and stock reflect the time of writing and may differ, so confirm with the seller before buying. Products are chosen and reviewed by our own standards, and commissions do not affect the order or content of reviews.