rm 中文man页面

系统
rm移除每个给定的文件。默认情况下,它不能移除目录。但是当给定了-r或者-R选项时,在指定目录之下的整个目录树都会被移除(而且对通过‘rm -r’能够移除的目录树深度是没有限制的)。当文件路径末端部分只有.和..时会出错(因此可用‘rm -r .*’之类来避免这些不愉快的诧异)。 如果给定了-i选项,或者如果一个文件不可写,而且标准输入是终端,又没有给定-f选项,那么rm会提示用户是否要删除该文件,它写一个问题到stderr并且从stdin读入一个应答。如果应答是否定的,该文件将被跳过。

名称

rm - 移除文件或者目录  

总览

rm [options] file...  

POSIX(Portable Operating System Interface 可移植的操作系统接口) 选项:

[-fiRr]  

GNU 选项 (最短格式):

[-dfirvR][--help][--version][--]  

描述

rm移除每个给定的文件。默认情况下,它不能移除目录。但是当给定了-r或者-R选项时,在指定目录之下的整个目录树都会被移除(而且对通过‘rm -r’能够移除的目录树深度是没有限制的)。当文件路径末端部分只有.和..时会出错(因此可用‘rm -r .*’之类来避免这些不愉快的诧异)。 如果给定了-i选项,或者如果一个文件不可写,而且标准输入是终端,又没有给定-f选项,那么rm会提示用户是否要删除该文件,它写一个问题到stderr并且从stdin读入一个应答。如果应答是否定的,该文件将被跳过。  

POSIX选项

-f
不作确认提示。不会写出诊断信息。如果错误只是文件不存在,那么不会生成一个状态返回的错误。
-i进行确认提示。(在同时给定了-f和-i选项时,列在***的生效。)
-r
或者 -R 递归地移除目录树。

SVID(System V Interface Definition)细节

System V接口定义(SVID)禁止移除正在执行的可执行二进制文件的***一个链接。  

GNU细节

GNU的实现(在fileutils-3.16中)会因为可移除的层次深度的上限而招致损坏。(如果确实必要,可使用‘deltree’工具来移除非常深的目录树。)  

GNU选项

-d,--directory
用unlink(2)来替代rmdir(2)移除目录,而且不要求目录为空移除目录使用的方式是unlink(2),而非rmdir(2),且在试图unlink目录之前不要求其为空。这仅在你有合适权限时才能生效。因为unlink一个目录会导致在删除目录下的文件非关联化,因此聪明的方法是在执行此之后fsck(8)文件系统。
-f,--force
忽略不存在的文件,并且从不向用户提示。
-i,--interactive
提示是否移除每个文件。如果回答是否定的,文件将被跳过。
-r,-R,--recursive
递归地移除目录中的内容。
-v,--verbose
在移除每个文件之前打印其名称。

GNU 标准选项

--help
在标准输出上打印用法信息,并且以成功状态退出。
--version
在标准输出上打印版本信息,然后以成功状态退出。
--
终止选项列表

环境变量

变量LANG,LC_ALL,LC_COLLATE,LC_CTYPE和LC_MESSAGES取其通常的含义。  

适应规则

POSIX 1003.2,关于文件层次深度的限制除外。  

备注

本页介绍了包括在fileutils-3.16包中的rm;其他版本的可能会有细微的差别。请把您的修正和增补建议发邮件到aeb@cwi.nl, aw@mail1.bet1.puv.fi和ragnar@lightside.ddns.org。报告程序中的bug请发到 fileutils-bugs@gnu.ai.mit.edu。  

#p#

NAME

rm - remove files or directories  

SYNOPSIS

rm [OPTION]... FILE...  

DESCRIPTION

This manual page documents the GNU version of rm. rm removes each specified file. By default, it does not remove directories. If a file is unwritable, the standard input is a tty, and the -f or --force option is not given, rm prompts the user for whether to remove the file. If the response does not begin with `y' or `Y', the file is skipped.  

OPTIONS

Remove (unlink) the FILE(s).

-d, --directory
unlink FILE, even if it is a non-empty directory (super-user only; this works only if your system
supports `unlink' for nonempty directories)
-f, --force
ignore nonexistent files, never prompt
-i, --interactive
prompt before any removal
--no-preserve-root do not treat `/' specially (the default)
--preserve-root
fail to operate recursively on `/'
-r, -R, --recursive
remove the contents of directories recursively
-v, --verbose
explain what is being done
--help
display this help and exit
--version
output version information and exit

To remove a file whose name starts with a `-', for example `-foo', use one of these commands:

rm -- -foo
rm ./-foo

Note that if you use rm to remove a file, it is usually possible to recover the contents of that file. If you want more assurance that the contents are truly unrecoverable, consider using shred.  

AUTHOR

Written by Paul Rubin, David MacKenzie, Richard Stallman, and Jim Meyering.  

REPORTING BUGS

Report bugs to <bug-coreutils@gnu.org>.  

COPYRIGHT

Copyright © 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  

SEE ALSO

chattr(1), shred(1)

The full documentation for rm is maintained as a Texinfo manual. If the info and rm programs are properly installed at your site, the command

info coreutils rm

should give you access to the complete manual.

责任编辑:韩亚珊 来源: CMPP.net
相关推荐

2011-08-24 16:48:36

man中文man

2011-08-15 10:21:09

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-25 15:39:42

fcloseall中文man

2011-08-25 15:00:15

cfgetispeed中文man

2011-08-25 09:29:35

udp中文man

2011-08-19 18:35:50

issue中文man

2011-08-25 17:03:51

pclose中文man

2011-08-25 17:40:25

setvbuf中文man

2011-08-23 14:21:16

poweroff中文man

2011-08-24 15:52:59

intro中文man

2011-08-23 13:40:31

2011-08-25 15:54:08

ferror中文man

2011-08-25 14:40:27

basename中文man

2011-08-25 17:24:54

puts中文man

2011-08-24 18:05:31

SHOW中文man

2011-08-25 18:34:55

ungetc中文man

2011-08-23 10:03:40

useradd中文man

2011-08-16 10:42:30

rmmod中文man
点赞
收藏

51CTO技术栈公众号