> For the complete documentation index, see [llms.txt](https://linux-in-action.gitbook.io/project/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://linux-in-action.gitbook.io/project/wen-jian-xi-tong/rm.md).

# rm 命令

在 Linux 中，删除（deleting）叫作移除（removing）。`rm` 命令可以删除一个目录中的一个或多个文件或目录，也可以将某个目录及其下属的所有文件及其子目录均删除掉。对于链接文件，只是删除整个链接文件，而原有文件保持不变。

## 命令用法

```
$ rm [OPTIONs] [FILEs]
```

默认情况下，`rm` 命令不会删除目录。使用 `--recursive`(`-r` 或 `-R`)选项可以删除每个列出的目录以及目录的内容。

## 常用可选参数

| 参数                  | 说明                        |
| ------------------- | ------------------------- |
| -f, --force         | 强制执行删除，忽略不存在的文件和参数，从不提示用户 |
| -i                  | 每个删除动作执行前提示用户             |
| -r, -R, --recursive | 递归地删除目录以及目录的内容            |
| -d, --dir           | 删除空目录                     |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://linux-in-action.gitbook.io/project/wen-jian-xi-tong/rm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
