Linux killall command

The killall command in Linux is used to terminate or send a signal to multiple processes based on their names. It allows you to kill or signal all processes that match a specific name or pattern, making it a convenient way to terminate multiple processes at once.

The basic syntax of the killall command is:

killall [options] process_name

Here are some commonly used options with the killall command:

  • -i or --interactive: This option prompts for confirmation before killing each process.
  • -q or --quiet: This option suppresses the error messages if no processes are found.
  • -s signal or --signal signal: This option specifies the signal to send to the processes. The default signal is SIGTERM (termination signal).

Now, let’s look at a practical example to illustrate the usage of the killall command:

killall firefox

In this example, the killall command is used to terminate all processes with the name “firefox”. It sends the SIGTERM signal by default, which gracefully terminates the processes.

You can also specify a signal explicitly using the -s option. For instance, to send the SIGKILL signal (forceful termination) to all processes named “firefox”, you can use:

killall -s SIGKILL firefox

It’s important to note that the killall command can be powerful, and it terminates processes without asking for confirmation by default. So, exercise caution when using it to avoid unintentional termination of critical processes.

Additionally, some Linux distributions also provide the pkill command, which is similar to killall but allows you to match processes based on more criteria, such as the user who owns the process or the process’s command line.

For more information and available options, you can refer to the manual page of killall by typing man killall in your terminal.