Scroll to navigation

RM(1) 使用者命令 RM(1)

名稱

rm - 移除檔案或者目錄

概述

rm [選項]... 檔案列表...

描述

本手冊頁記錄 GNU 版本的 rmrm 移除每一個指定的檔案。預設情況下,它不刪除目錄。

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) 給定檔案。

忽略不存在的檔案和引數,從不提示
在每次刪除前提示
在進行遞迴刪除或刪除多於三個檔案之前提示使用者一次;與 -i 相比較更少干擾使用者,但是仍然為大多數操作失誤起到保護作用。
根據 WHEN 確定提示使用者的頻率: "never"(從不)、"once" (-I)、或者 "always" (-i);如果沒有給定 WHEN 引數,則總是提示使用者。
在遞迴地刪除一個目錄結構時,跳過與對應命令列引數不在同一個檔案系統中的所有目錄
不對 '/' 做特殊處理
不要刪除“/”(預設行為);如添加了“all”引數,將拒絕處理與父目錄位於不同裝置上的命令列引數
遞迴地移除目錄及它們的內容
刪除空目錄
解釋正在發生的情況
顯示此幫助資訊並退出
顯示版本資訊並退出

預設情況下,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