• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# kill<a name="EN-US_TOPIC_0000001179965835"></a>
2
3-   [Command Function](#section366714216619)
4-   [Syntax](#section8833164614615)
5-   [Parameters](#section12809111019453)
6-   [Usage](#section15935131220717)
7-   [Example](#section79281818476)
8-   [Output](#section12742311179)
9
10## Command Function<a name="section366714216619"></a>
11
12This command is used to send a specific signal to a specified process.
13
14## Syntax<a name="section8833164614615"></a>
15
16kill \[_signo_  |  _-signo_\] \[_pid_\]
17
18## Parameters<a name="section12809111019453"></a>
19
20**Table  1**  Parameter description
21
22<a name="table438mcpsimp"></a>
23<table><thead align="left"><tr id="row444mcpsimp"><th class="cellrowborder" valign="top" width="21%" id="mcps1.2.4.1.1"><p id="p446mcpsimp"><a name="p446mcpsimp"></a><a name="p446mcpsimp"></a>Parameter</p>
24</th>
25<th class="cellrowborder" valign="top" width="51.92%" id="mcps1.2.4.1.2"><p id="p448mcpsimp"><a name="p448mcpsimp"></a><a name="p448mcpsimp"></a>Description</p>
26</th>
27<th class="cellrowborder" valign="top" width="27.08%" id="mcps1.2.4.1.3"><p id="p450mcpsimp"><a name="p450mcpsimp"></a><a name="p450mcpsimp"></a>Value Range</p>
28</th>
29</tr>
30</thead>
31<tbody><tr id="row451mcpsimp"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p2500105121818"><a name="p2500105121818"></a><a name="p2500105121818"></a>signo</p>
32</td>
33<td class="cellrowborder" valign="top" width="51.92%" headers="mcps1.2.4.1.2 "><p id="p1149945111817"><a name="p1149945111817"></a><a name="p1149945111817"></a>Specifies the signal ID.</p>
34</td>
35<td class="cellrowborder" valign="top" width="27.08%" headers="mcps1.2.4.1.3 "><p id="p749810571812"><a name="p749810571812"></a><a name="p749810571812"></a>[1,30]</p>
36</td>
37</tr>
38<tr id="row113001232165611"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p18301173213562"><a name="p18301173213562"></a><a name="p18301173213562"></a>pid</p>
39</td>
40<td class="cellrowborder" valign="top" width="51.92%" headers="mcps1.2.4.1.2 "><p id="p1730143212569"><a name="p1730143212569"></a><a name="p1730143212569"></a>Specifies the process ID.</p>
41</td>
42<td class="cellrowborder" valign="top" width="27.08%" headers="mcps1.2.4.1.3 "><p id="p1301193275618"><a name="p1301193275618"></a><a name="p1301193275618"></a>[1,MAX_INT]</p>
43</td>
44</tr>
45</tbody>
46</table>
47
48>![](../public_sys-resources/icon-notice.gif) **NOTICE:**
49>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.
50
51## Usage<a name="section15935131220717"></a>
52
53The  **signo**  and  **pid**  parameters are mandatory.
54
55The  **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\].
56
57## Example<a name="section79281818476"></a>
58
591.  Query the process list and determine the PID \(7\) of the process to be killed.
60
61**Figure  1**  Querying PIDs<a name="fig6133125414256"></a>
62![](figure/querying-pids.png "querying-pids")
63
642. 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.
65
66**Figure  2**  Command output<a name="fig2281711563"></a>
67![](figure/command-output.png "command-output")
68
69## Output<a name="section12742311179"></a>
70
71The command output is as follows:
72
73**Figure  3**  Sending a signal to a specified process<a name="fig11800272147"></a>
74![](figure/sending-a-signal-to-a-specified-process.png "sending-a-signal-to-a-specified-process")
75
76The signal is successfully sent if no error is reported.
77
78**Figure  4**  Signal sending failure<a name="fig24081235151813"></a>
79![](figure/signal-sending-failure.png "signal-sending-failure")
80
81The signal fails to send due to invalid parameters. Check the signal ID and PID for fault.
82
83