# rm
## Command Function
This command is used to delete a file or folder.
## Syntax
rm \[_-r_\] \[_dirname / filename_\]
## Parameters
**Table 1** Parameter description
Parameter
|
Description
|
Value Range
|
-r
|
Deletes a directory. This parameter is optional. It is required if a directory is to be deleted.
|
N/A
|
dirname/filename
|
Specifies the name of the file or directory to be deleted. The value can be a path.
|
N/A
|
## Usage
- The **rm** command deletes only one file or directory at a time.
- The **rm -r** command can be used to delete a non-empty directory.
## Example
Example:
1. Run **rm log1.txt**.
2. Run **rm -r sd**.
## Output
**Figure 1** Deleting the **log1.txt** file

**Figure 2** Deleting the **sd** directory
