RM(1) | 用户命令 | RM(1) |
名称¶
rm - 移除文件或者目录
概述¶
rm [选项]... 文件列表...
描述¶
本手册页记录 GNU 版本的 rm。rm 移除每一个指定的文件。默认情况下,它不删除目录。
If the -I or --interactive=once option is given, and there are more than three files or the -r, -R, or --recursive are given, then rm prompts the user for whether to proceed with the entire operation. If the response is not affirmative, the entire command is aborted.
Otherwise, if a file is unwritable, standard input is a terminal, and the -f or --force option is not given, or the -i or --interactive=always option is given, rm prompts the user for whether to remove the file. If the response is not affirmative, the file is skipped.
选项¶
删除 (unlink) 给定文件。
- -f, --force
- 忽略不存在的文件和参数,从不提示
- -i
- 在每次删除前提示
- -I
- 在进行递归删除或删除多于三个文件之前提示用户一次;与 -i 相比较更少干扰用户,但是仍然为大多数操作失误起到保护作用。
- --interactive[=WHEN]
- 根据 WHEN 确定提示用户的频率: "never"(从不)、"once" (-I)、或者 "always" (-i);如果没有给定 WHEN 参数,则总是提示用户。
- --one-file-system
- 在递归地删除一个目录结构时,跳过与对应命令行参数不在同一个文件系统中的所有目录
- --no-preserve-root
- 不对 '/' 做特殊处理
- --preserve-root[=all]
- 不要删除“/”(默认行为);如添加了“all”参数,将拒绝处理与父目录位于不同设备上的命令行参数
- -r, -R, --recursive
- 递归地移除目录及它们的内容
- -d, --dir
- 删除空目录
- -v, --verbose
- 解释正在发生的情况
- --help
- 显示此帮助信息并退出
- --version
- 显示版本信息并退出
默认情况下,rm 不移除目录。可以使用 --recursive(-r 或 -R)选项来同时移除列出的每个目录及其内容。
如果需要删除一个文件名以连字符 “-”起始的文件,例如 '-foo',请使用下列命令:
- rm -- -foo
- rm ./-foo
请注意,如果你使用 rm 删除一个文件,在有足够技术水平和/或时间的情况下,它的部分内容可能仍然能够被恢复。如果需要更高的保障来使得文件内容不可恢复,请考虑使用 shred.
作者¶
由 Paul Rubin, David MacKenzie, Richard M. Stallman 和 Jim Meyering 编写。
报告错误¶
GNU coreutils 的在线帮助:
<https://www.gnu.org/software/coreutils/>
请向 <https://translationproject.org/team/zh_CN.html>
报告翻译错误。
版权¶
Copyright © 2020 Free Software Foundation, Inc. License
GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO
WARRANTY, to the extent permitted by law.
参见¶
unlink(1), unlink(2), chattr(1), shred(1)
完整文档请见:
<https://www.gnu.org/software/coreutils/rm>
或者在本地使用: info
'(coreutils) rm invocation'
跋¶
本页面中文版由中文
man 手册页计划提供。
中文 man
手册页计划:https://github.com/man-pages-zh/manpages-zh
2020年三月 | GNU coreutils 8.32 |