RM(C) UNIX System V
Name
rm - removes files or directories
Syntax
rm [ -fri ] file ...
Description
rm removes the entries for one or more files from a
directory. If an entry was the last link to the file, the
file is destroyed. Removal of a file requires write
permission in its directory, but neither read nor write
permission on the file itself.
If the user does not have write permission on a specified
file and the standard input is a terminal, the user is
prompted for confirmation. The file's name and permissions
are printed and a line is read from the standard input. If
that line begins with y, the file is deleted, otherwise the
file remains. If the -f option is given or if the standard
input is not a terminal, no messages are issued; files are
simply removed.
rm will not delete directories unless the -r option is used.
Options
The following options are recognized.
-f When invoked with the -f option, rm does not prompt the
user for confirmation for files on which the user does
not have write permission. The files are simply removed.
-r The -r (recursive) option causes rm to recursively delete
the entire contents of the any directories specified, and
the directories themselves. Note that the rmdir(C)
command is a safer way of removing directories.
-i The -i (interactive) option causes rm to ask whether to
delete each file, and if the -r option is in effect,
whether to examine each directory.
The special option ``--'' can be used to delimit options.
For example, a file named ``-f'' could not be removed by rm
because the hyphen is interpreted as an option; the command
rm -f would do nothing, since no file is specified. Using
rm -- -f removes the file successfully.
See Also
rmdir(C)
Notes
It is forbidden to remove the file .. to avoid the
consequences of inadvertently doing something like:
rm -r .*
It is also forbidden to remove the root directory of a given
file system.
No more than 17 levels of subdirectories can be removed
using the -r option.
Standards Conformance
rm is conformant with:
AT&T SVID Issue 2, Select Code 307-127;
and The X/Open Portability Guide II of January 1987.
(printed 2/15/90) RM(C)