• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# rm<a name="EN-US_TOPIC_0000001134006266"></a>
2
3-   [Command Function](#section181141523142613)
4-   [Syntax](#section8800926132619)
5-   [Parameters](#section15476229152617)
6-   [Usage](#section10578163215262)
7-   [Example](#section18548133511263)
8-   [Output](#section1565323814265)
9
10## Command Function<a name="section181141523142613"></a>
11
12This command is used to delete a file or folder.
13
14## Syntax<a name="section8800926132619"></a>
15
16rm \[_-r_\] \[_dirname / filename_\]
17
18## Parameters<a name="section15476229152617"></a>
19
20**Table  1**  Parameter description
21
22<a name="table1507mcpsimp"></a>
23<table><thead align="left"><tr id="row1513mcpsimp"><th class="cellrowborder" valign="top" width="22.220000000000002%" id="mcps1.2.4.1.1"><p id="p1515mcpsimp"><a name="p1515mcpsimp"></a><a name="p1515mcpsimp"></a><strong id="b8231115224817"><a name="b8231115224817"></a><a name="b8231115224817"></a>Parameter</strong></p>
24</th>
25<th class="cellrowborder" valign="top" width="51.519999999999996%" id="mcps1.2.4.1.2"><p id="p1517mcpsimp"><a name="p1517mcpsimp"></a><a name="p1517mcpsimp"></a><strong id="b1599275514488"><a name="b1599275514488"></a><a name="b1599275514488"></a>Description</strong></p>
26</th>
27<th class="cellrowborder" valign="top" width="26.26%" id="mcps1.2.4.1.3"><p id="p1519mcpsimp"><a name="p1519mcpsimp"></a><a name="p1519mcpsimp"></a><strong id="b186611453114810"><a name="b186611453114810"></a><a name="b186611453114810"></a>Value Range</strong></p>
28</th>
29</tr>
30</thead>
31<tbody><tr id="row1520mcpsimp"><td class="cellrowborder" valign="top" width="22.220000000000002%" headers="mcps1.2.4.1.1 "><p id="p1522mcpsimp"><a name="p1522mcpsimp"></a><a name="p1522mcpsimp"></a>-r</p>
32</td>
33<td class="cellrowborder" valign="top" width="51.519999999999996%" headers="mcps1.2.4.1.2 "><p id="p1524mcpsimp"><a name="p1524mcpsimp"></a><a name="p1524mcpsimp"></a>Deletes a directory. This parameter is optional. It is required if a directory is to be deleted.</p>
34</td>
35<td class="cellrowborder" valign="top" width="26.26%" headers="mcps1.2.4.1.3 "><p id="p1526mcpsimp"><a name="p1526mcpsimp"></a><a name="p1526mcpsimp"></a>N/A</p>
36</td>
37</tr>
38<tr id="row1527mcpsimp"><td class="cellrowborder" valign="top" width="22.220000000000002%" headers="mcps1.2.4.1.1 "><p id="p1529mcpsimp"><a name="p1529mcpsimp"></a><a name="p1529mcpsimp"></a>dirname/filename</p>
39</td>
40<td class="cellrowborder" valign="top" width="51.519999999999996%" headers="mcps1.2.4.1.2 "><p id="p1531mcpsimp"><a name="p1531mcpsimp"></a><a name="p1531mcpsimp"></a>Specifies the name of the file or directory to be deleted. The value can be a path.</p>
41</td>
42<td class="cellrowborder" valign="top" width="26.26%" headers="mcps1.2.4.1.3 "><p id="p1533mcpsimp"><a name="p1533mcpsimp"></a><a name="p1533mcpsimp"></a>N/A</p>
43</td>
44</tr>
45</tbody>
46</table>
47
48## Usage<a name="section10578163215262"></a>
49
50-   The  **rm**  command deletes only one file or directory at a time.
51-   The  **rm -r**  command can be used to delete a non-empty directory.
52
53## Example<a name="section18548133511263"></a>
54
55Example:
56
571.  Run  **rm log1.txt**.
582.  Run  **rm -r sd**.
59
60## Output<a name="section1565323814265"></a>
61
62**Figure  1**  Deleting the  **log1.txt**  file<a name="fig886111415523"></a>
63![](figure/deleting-the-log1-txt-file.png "deleting-the-log1-txt-file")
64
65**Figure  2**  Deleting the  **sd**  directory<a name="fig20659194885211"></a>
66![](figure/deleting-the-sd-directory.png "deleting-the-sd-directory")
67
68