Linux命令学习总结:rm命令

王朝学院·作者佚名  2016-05-27
窄屏简体版  字體: 小  |  中  |  大  |  超大  

linux命令学习总结:rm命令 2014-07-26 12:35 by 潇湘隐者, ... 阅读, ... 评论, 收藏, 编辑 命令简介: 该命令用来删除Linux系统中的文件或目录。通常情况下rm不会删除目录,你必须通过指定参数-r或-R来删除目录。另外rm通常可以将该文件或目录恢复(注意,rm删除文件其实只是将指向数据块的索引点(information nodes)释放,只要不被覆盖,数据其实还在硬盘上。如果想要保证文件的内容无法复原,可以使用命令shred 。 另外一般还是要慎用rm -rf *这样的命令。 执行权限 :All User 指令所在路径:/bin/rm 命令语法: rm [OPTION]... FILE... 命令参数: 参数

长参数

描叙

-f

--force

强制删除,忽略不存在的文件,从不给出提示。

-i

--interactive

交互模式删除文件,删除文件前给出提示。

-r

--recursive

递归的删除目录下面文件以及子目录下文件。

-R

--recursive

递归的删除目录下面文件以及子目录下文件。

-v

--verbose

显示运行时详细信息

--help

显示命令在线帮助

--version

显示命令版本信息

使用示例:

1:查看获取rm命令的帮助信息。

[root@DB-Server kerry]# man rm

RM(1) User Commands RM(1)

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 is not affirmative, the file is skipped.

OPTIONS

Remove (unlink) the FILE(s).

-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 directories and their contents recursively

-v, --verbose

explain what is being done

--help display this help and exit

--version

output version information and exit

By default, rm does not remove directories. Use the --recursive (-r or -R) option to remove each listed directory, too, along with all of its contents.

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 漏 2006 Free Software Foundation, Inc.

This is free software. You may redistribute copies of it under the terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>. There

is NO WARRANTY, to the extent permitted by law.

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

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有 導航