RM(1) SysV RM(1)
NAME
rm, rmdir - remove files or directories
SYNOPSIS
rm [-f] [-i] file ...
rm -r [-f] [-i] dirname ... [file ...]
rmdir [-p] [-s] dirname ...
DESCRIPTION
The rm command 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 a file has no write permission and the standard input is a terminal,
the full set of permissions (in octal) for the file are printed followed
by a question mark. This is a prompt for confirmation. If the answer
begins with y (for yes), the file is deleted, otherwise the file remains.
Note that if the standard input is not a terminal, the command will
operate as if the -f option is in effect.
The rmdir command removes the named directories, which must be empty.
OPTIONS
The following options apply to the rm command:
-f Remove all files (whether write-protected or not) in a directory
without prompting the user. In a write-protected directory,
however, the files are not removed, though no error messages are
displayed.
(NOTE: rm -f cannot remove Domain/OS keep-protected files)
-r Recursively remove any directories and subdirectories in the
argument list. The directory will be emptied of files and removed.
Normally, you are prompted for removal of any write-protected files
that the directory contains. The write-protected files are removed
without prompting, however, if the -f option is used, or if the
standard input is not a terminal and the -i option is not used.
If the removal of a non-empty, write-protected directory was
attempted, the command will always fail (even if the -f option is
used), resulting in an error message.
-i With this option, confirmation of removal of any write-protected
file occurs interactively. It overrides the -f option and remains
in effect even if the standard input is not a terminal.
The following options apply to the rmdir command:
-p Remove the directory dirname and its parent directories which become
empty as a result. Print a message on standard output telling
whether the whole path is removed or part of the path remains for
some reason.
-s Suppress the message printed on standard error when -p is in effect.
DIAGNOSTICS
All messages are generally self-explanatory.
It is forbidden to remove the files "." and ".." in order to avoid the
consequences of inadvertently doing something like the following:
rm -r .*
Both rm and rmdir return exit codes of 0 if all the specified directories
are removed successfully. Otherwise, they return a non-zero exit code.
SEE ALSO
unlink(2), rmdir(2).