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

killall [OPTION]... PROCESS_NAME...

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

killall firefox

Sends a SIGTERM signal to all running processes named firefox.

Forcefully kill a program

killall -9 chrome
# 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

killall -u john_doe sshd

Kills all sshd processes that are owned by the user john_doe.

Kill processes older than a certain time

killall -o 1h apache2

Kills all apache2 processes that have been running for more than 1 hour.

Interactive killall

killall -i nano

Prompts for confirmation before killing each nano process.

See also