1# rm 2 3 4## Command Function 5 6This command is used to delete a file or folder. 7 8 9## Syntax 10 11rm [_-fv_] *FILE or rm* [_-rv_] [_PATH_ | _filename_]... 12 13 14## Parameters 15 16**Table 1** Parameter description 17 18| Parameter | Description | 19| ------------- | ------------------------------------------------ | 20| -r | Deletes empty or non-empty directories. | 21| -f | Deletes a file or directory forcibly without confirmation. No error will be reported when a file that does not exist is to be deleted.| 22| -v | Displays the deletion process. | 23| PATH/filename | Specifies the name of the file or directory to delete. The value can be a path. | 24 25 26## Usage Guidelines 27 28- The **rm** command can be used to delete multiple files or folders at a time. 29 30- You can run **rm -r** to delete a non-empty directory. 31 32- If the **rm** command without **-f** is used to delete a file that does not exist, an error will be reported. 33 34## Note 35 36The shell does not support **-v** or **-f**. mksh supports them. To switch to mksh, run **cd bin** and **./mksh**. 37 38## Example 39 40Run the following commands: 41 42- rm testfile 43 44- rm -r testpath/ 45 46 47## Output 48 49Example 1: Delete **testfile**. 50 51 52``` 53OHOS:/$ ls 54bin etc proc storage testfile usr 55dev lib sdcard system userdata vendor 56OHOS:/$ rm testfile 57OHOS:/$ ls 58bin etc proc storage userdata vendor 59dev lib sdcard system usr 60``` 61 62Example 2: Delete **testpath**, a non-empty directory. 63 64 65``` 66OHOS:/$ ls 67bin etc proc storage testpath usr 68dev lib sdcard system userdata vendor 69OHOS:/$ rm -r testpath/ 70OHOS:/$ ls 71bin etc proc storage userdata vendor 72dev lib sdcard system usr 73``` 74