0
0
Linux-cliHow-ToBeginner · 3 min read

How to Use killall Command in Linux: Syntax and Examples

The killall command in Linux terminates processes by their name instead of process ID. Use killall process_name to stop all processes matching that name quickly and easily.
📐

Syntax

The basic syntax of killall is simple and consists of the command followed by options and the process name.

  • killall [options] process_name: Sends a signal to all processes matching process_name.
  • Options can modify behavior, like specifying the signal to send.
bash
killall [options] process_name
💻

Example

This example shows how to use killall to stop all running instances of firefox by name.

bash
killall firefox
Output
firefox: no process found
⚠️

Common Pitfalls

Common mistakes include:

  • Using killall without root privileges when required, causing failure to kill some processes.
  • Typing the wrong process name, which results in no processes being killed.
  • Not specifying the correct signal if the default SIGTERM does not stop the process.

Always double-check the process name and consider using -9 option to force kill if needed.

bash
killall wrongname
killall -9 firefox
Output
killall: no process found
📊

Quick Reference

CommandDescription
killall process_nameKill all processes with the given name using SIGTERM
killall -9 process_nameForce kill all processes with SIGKILL signal
killall -u username process_nameKill processes by name owned by a specific user
killall -q process_nameQuiet mode, no output
killall -v process_nameVerbose mode, shows what is killed

Key Takeaways

Use killall process_name to terminate all processes by name quickly.
Specify signals like -9 to force kill if normal termination fails.
Ensure you have the right permissions to kill the target processes.
Double-check the process name to avoid killing unintended processes.
Use options like -u to target processes by user.