kill
Command Function
This command is used to send a specific signal to a specified process.
Syntax
kill [signo | -signo] [pid]
Parameter Description
Table 1 Parameters
NOTICE: The valid range of the signo value is [0, 64], and the recommended value range is [1, 30]. Other values in the valid range are reserved.
Usage
The signo and pid parameters are mandatory.
The pid value range varies depending on the system configuration. For example, if the maximum pid value supported by the system is 256, this value range is [1-256].
Example
- Query the current process list and determine the PID (7) of the process to be killed.
- Run kill 14 7 to send signal 14 (the default behavior of SIGALRM is to terminate the process) to process 7 helloworld_d (user-space). Then query the current process list. Process 7 has been terminated. The result of the kill 14 7 command is the same as that of the kill -14 7 command.
Output
The command output is as follows:
Figure 3 Sending a signal to a specified process
The signal is successfully sent if no error is reported.
Figure 4 Signal sending failure
The preceding figure shows a signal sending failure caused by invalid parameters. In this case, check that the signal ID and PID are valid.