killall: Send a signal to all processes matching a given name
August 9th, 2024 1:09 PM Mr. Q Categories: Command
Command: killall
The killall
command sends a specified signal to all processes matching a given name. By default, killall
sends the SIGTERM
signal, which requests a graceful shutdown of the processes. It is a powerful tool, especially when you need to terminate multiple instances of the same process.
Sample Commands and Outputs:
killall process_name
: Sends the defaultSIGTERM
signal to all processes with the specified name. Sample Command and Output:
$ killall firefox
Description:
firefox
: The name of the process to terminate. This command will send theSIGTERM
signal to all running instances offirefox
, requesting them to shut down gracefully.killall -9 process_name
: Sends theSIGKILL
signal, forcefully terminating all processes with the specified name. Sample Command and Output:
$ killall -9 firefox
Description:
-9
: The option to send theSIGKILL
signal, which forces an immediate shutdown.firefox
: The name of the process to terminate. This command will forcefully kill all running instances offirefox
.killall -u username
: Sends theSIGTERM
signal to all processes owned by the specified user. Sample Command and Output:
$ killall -u davidq
Description:
-u davidq
: The option to target all processes owned by the userdavidq
. This command will send theSIGTERM
signal to gracefully shut down all processes started bydavidq
.killall -v process_name
: Provides verbose output, showing which processes were terminated. Sample Command and Output:
$ killall -v firefox
Terminated firefox(1234) ...
Terminated firefox(5678) ...
Description:
-v
: The option for verbose output, detailing the PIDs of the processes terminated.
Note: The killall
command is particularly useful for managing multiple instances of the same process. However, use it with caution, especially with powerful signals like SIGKILL
, as it can terminate all matching processes without discrimination, potentially causing data loss or disruption.