Killall command
“killall” follows the following structure –
According to the man page of “killall”, the tool sends a signal to the target processes. Without specifying the signal type, the default is SIGTERM. If “killall” is able to kill at least 1 process matching the requirements, it returns a zero return code. You can’t kill a “killall” process.
Killing a process
This is the most basic usage of “killall” command. All you have to do is just pass the name of the process.
For example, I’ve got GNOME Disks open, process name “gnome-disks”. For killing the process, run the following command –
Asking for permission
When you’re running “killall” commands, there’s a pretty good chance that you’re about to kill something unintended. You have to use the “-i” flag.
Case sensitivity
Generally, “killall” is a case-sensitive tool, so make sure that you type the name correctly.
killall GNOME-disks
# Correct command
killall gnome-disks
If you want to force killall as case-insensitive, use “-I” flag.
Choosing the ENDING signal
There are different types of termination signal available. If you want to use a specific end signal, use the following structure –
# OR
killall –signal
# OR
killall -SIGNAL
For finding out the available signal list, use the “-l” flag.
Killing process by the time
You can also tell “killall” to terminate the processes depending on their time of running!
# OR
killall –older-than [TIME]
For example,
This command will kill all the processes that have been running for more than 2 hours.
# OR
killall –younger-than [TIME]
For example,
This command will kill all the processes that are younger than 2 hours.
Killing all the processes owned by a user
This is a very risky thing to do and may even render your system useless unless you restart it. Make sure that you have all your important tasks finished.
The structure goes like this –
For example,
This command will kill everything under the user “viktor”.
Other “killall” commands
There are a number of other available commands of “killall”. For the short list, use the following command –
For an in-depth explanation of every single parameter and options, the man page is the best option.
You can export the man page to a separate text file for reading later.
Enjoy!