killall Command
The killall command in Linux is used to terminate running processes by their name. Unlike the kill command which requires a Process ID (PID), killall can send a signal to all processes that match a given name, making it very convenient for stopping all instances of a particular program.
Syntax
Description
killall sends a signal to all processes whose executable name matches the provided PROCESS_NAME. By default, it sends the SIGTERM signal, which requests a graceful shutdown. If a process does not respond to SIGTERM, you might need to send a more forceful signal like SIGKILL.
Common uses include:
- Terminating all instances of a specific application.
- Sending different signals to processes.
- Shutting down services gracefully or forcefully.
Common Options
| Option | Description |
|---|---|
-e, --exact |
Require exact match for process name. |
-i, --interactive |
Ask for confirmation before killing. |
-o, --older-than <time> |
Kill processes older than specified time (e.g., 1h, 1d). |
-q, --quiet |
Do not complain if no processes were killed. |
-r, --regexp |
Interpret process name as an extended regular expression. |
-s, --signal <signal> |
Send a specific signal instead of SIGTERM. |
-u, --user <user> |
Kill only processes owned by a specific user. |
-v, --verbose |
Report what is being done. |
Examples
Kill all instances of a program
Sends a SIGTERM signal to all running processes named firefox.
Forcefully kill a program
# Or:
killall -s SIGKILL chrome
Sends a SIGKILL signal (signal 9) to all chrome processes, which cannot be ignored.
Kill processes owned by a specific user
Kills all sshd processes that are owned by the user john_doe.
Kill processes older than a certain time
Kills all apache2 processes that have been running for more than 1 hour.
Interactive killall
Prompts for confirmation before killing each nano process.