Ubuntu

Ubuntu Killall Command

Every single Linux distros is a collection of standard and something other tools at the core. Ubuntu, being one of the most popular ones, offers the most popular and powerful Linux tools in the wild. “killall” is such a powerful tool at your disposal. Let’s find out what you can do with “killall”. It’s just like “kill” but with a lot more power in the pocket. It’s a CLI tool. Caution is a must as a wrong command can completely render your system useless.

Killall command

“killall” follows the following structure –

killall [OPTIONS] name

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 –

killall gnome-disks

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.

killall -i gnome-disks

Case sensitivity

Generally, “killall” is a case-sensitive tool, so make sure that you type the name correctly.

# Wrong command
killall GNOME-disks

# Correct command
killall gnome-disks

If you want to force killall as case-insensitive, use “-I” flag.

killall -I GNOME-disks

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 –

killall -s

# OR
killall --signal

# OR
killall -SIGNAL

For finding out the available signal list, use the “-l” flag.

killall -l

Killing process by the time

You can also tell “killall” to terminate the processes depending on their time of running!

killall -o [TIME]

# OR
killall --older-than [TIME]

For example,

killall -o 2h

This command will kill all the processes that have been running for more than 2 hours.

killall -y [TIME]

# OR
killall --younger-than [TIME]

For example,

killall -y 2h

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 –

killall -u [USERNAME]

For example,

killall -u viktor

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 –

killall --help

For an in-depth explanation of every single parameter and options, the man page is the best option.

man killall

You can export the man page to a separate text file for reading later.

man killall > ~/Desktop/killall.txt

Enjoy!

About the author

Sidratul Muntaha

Student of CSE. I love Linux and playing with tech and gadgets. I use both Ubuntu and Linux Mint.