How to use the Linux killall command

The Linux command killall terminates processes that no longer function properly and thus prevents a restart. To prevent errors, the command can be customised.

What is Linux killall?

In certain circumstances, even under a Linux environment, the system can become overwhelmed, causing individual programs or processes to malfunction or operate improperly. To circumvent the need for a complete system reboot in such situations, the killall command proves to be invaluable across most Linux distributions, such as Debian or Ubuntu. Despite its formidable moniker, the command serves a crucial purpose. It forcibly terminates all processes, excluding itself, thereby alleviating strain on your computer and conserving memory resources.

How does the Linux killall command work?

Linux killall is an emergency option when one or more processes become unresponsive or exhibit bad behaviour, rendering them unable to be terminated through standard means. It operates by issuing a signal to all active processes that match the commands specified within the killall command. The processes to be targeted can be identified using either their names or corresponding numerical identifiers.

What’s the syntax of the killall command?

The syntax of Linux killall looks as follows:

$ killall [Options] [Name]
bash

Precise spelling and case sensitivity are vital when specifying the process name with the killall command. In the absence of a specific process name, executing the killall command will terminate all background processes except for killall itself.

Which options are available with killall?

There are numerous options for Linux killall. The most important ones are:

  • -e or –exact: With this option you ensure that the exact spelling is taken into account even for long names. Otherwise only the first 15 characters of the command may be considered.
  • -g or –process-group: With this option you terminate the entire process group to which a process belongs.
  • -I or –ignore-case: This option ignores the upper and lower case.
  • -i or –interactive: Before terminating a process, this option interactively enquires about it.
  • -l or –list: The option spits out a list of all known signals.
  • -q or –quiet: With this option, you won’t receive a complaint if no process was terminated by the killall command.
  • -V or –version: With this option you get the version number.
  • -v or –verbose: Through this option you’ll receive a notification if a process has been successfully completed.
  • -w or –wait: With this option the Linux killall checks every second if all processes have been terminated.

Examples of the Linux killall command

Finally, here are a few examples of Linux killall:

$ killall
bash

This command stops all background processes immediately.

$ killall Example
bash

This command terminates the process ‘Example’.

$ killall -i Example
bash

The system asks for confirmation before ending the ‘Example’ process.

Was this article helpful?
Page top