Linux command kill -n

Usually, in Linux operation, we often encounter the operation of killing a process. Usually, after finding out the process to be killed,
we will use kill -9 process number to kill the process.
Many friends must be confused about other numerical parameters except the number 9. What is the role,
the following list several commonly used digital parameters

kill -ncommand is used to send a specific signal to the specified process. Among them, -nis a number indicating the number of the signal to be sent.

Commonly used signal numbers and their meanings are as follows:

  • 1(SIGHUP): terminal hung or control process terminated
  • 2(SIGINT): interrupt process (usually sent by Ctrl+C)
  • 3(SIGQUIT): exit the process and generate a core dump file
  • 9(SIGKILL): forcefully terminate the process
  • 15(SIGTERM): Gracefully terminate the process

For example, to send a SIGTERM signal to a process with process ID 12345, the following command can be used:

kill -15 12345

Note that only users with sufficient privileges (usually root) can send signals to other users' processes.

Guess you like

Origin blog.csdn.net/qq_24330181/article/details/131590014