首页
首页 » 文件管理 » rm(remove)

rm(remove)

rm(remove)
功能说明:删除文件或目录。
语  法:rm [-dfirv][--help][--version][文件或目录...]
补充说明:执行rm指令可删除文件或目录,如欲删除目录必须加上参数"-r",否则预设仅会删除文件。 
参  数:
 -d或--directory  直接把欲删除的目录的硬连接数据删成0,删除该目录。 
 -f或--force  强制删除文件或目录。 
 -i或--interactive  删除既有文件或目录之前先询问用户。 
 -r或-R或--recursive  递归处理,将指定目录下的所有文件及子目录一并处理。 
 -v或--verbose  显示指令执行过程。 
 --help  在线帮助。 
 --version  显示版本信息。

rm

rm [options] files

Delete one or more files. To remove a file, you must have write permission in the directory that contains the file, but you need not have permission on the file itself. If you do not have write permission on the file, you will be prompted (y or n) to override. rm is often aliased to rm -i, especially for the root user, to protect against inadvertently deleting files.

Options

-d, --directory

Remove directories, even if they are not empty. Available only to a privileged user.

-f, --force

Remove write-protected files without prompting.

--help

Print a help message and then exit.

-i, --interactive

Prompt for y (remove the file) or n (do not remove the file).

--no-preserve-root

Do not treat root (/) specially. This is the default.

--preserve-root

Do not operate recursively on root (/).

-r, -R, --recursive

If file is a directory, remove the entire directory and all its contents, including subdirectories. Be forewarned: use of this option can be dangerous.

-v, --verbose

Verbose mode (print the name of each file before removing it).

--version

Print version information and then exit.

--

Mark the end of options. Use this when you need to supply a filename beginning with -.