killall

Kill a group of processes using their name

Supplementary instructions

killall command uses the name of the process to kill the process. Use this command to kill a group of processes with the same name. We can use the kill command to kill the process with the specified process PID. If we want to find the process we need to kill, we also need to use commands such as ps and grep to find the process before, and killall combines these two processes into one. , is a very useful command.

grammar

killall(option)(parameter)

Options

-e: Exactly match long names;
-l: ignore case differences;
-p: Kill the process group to which the process belongs;
-i: Interactively kill the process, confirmation is required before killing the process;
-l: Print a list of all known signals;
-q: If no process is killed. No information is output;
-r: Use regular expressions to match the name of the process to be killed;
-s: Replace the default signal "SIGTERM" with the specified process number;
-u: Kill the process of the specified user.

Parameters

Process name: Specify the name of the process to be killed.

Example

# Kill all processes with the same name
killallvi
#Specify the signal sent to the process
killall -9 vi
# 0 signal means not to send a signal to the process. You can judge whether the process exists through the return value, 0 (exists) 1 (does not exist)
killall -0 vi
echo $?