RM(1) COMMAND REFERENCE RM(1)
NAME
rm - remove (unlink) files or directories
SYNOPSIS
rm [ -f ] [ -i ] [ -r ] [ - ] filename...
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 a file has no write permission or is currently busy (see
CAVEATS), and the standard input is a terminal, its
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. No questions are asked and no
errors are reported when the -f (force) option is given.
If a designated file is a directory, an error comment is
printed unless the optional argument -r has been used. In
that case, rm recursively deletes the entire contents of the
specified directory, and the directory itself.
If the -i (interactive) option is in effect, rm asks whether
to delete each file, and, under -r, whether to examine each
directory.
The null option - indicates that all the arguments following
it are to be treated as filenames. This allows the
specification of filenames starting with a minus.
It is forbidden to remove the file `..' merely to avoid the
antisocial consequences of inadvertently doing something
like rm-r.*.
If no filenames are given, a usage message is printed,
unless the -f option is given.
OPTIONS
-f No questions are asked and no errors are reported when
the -f (force) option is given.
-i Rm asks whether to delete each file, and, under -r,
whether to examine each directory.
-r Rm recursively deletes the entire contents of the
specified directory, and the directory itself.
- Indicates that all the arguments following it are to be
treated as filenames. This allows the specification of
Printed 10/17/86 1
RM(1) COMMAND REFERENCE RM(1)
filenames starting with a minus.
EXAMPLES
The following example removes the contents of the directory
/usr/example and each of its subdirectories, and the
directory itself. It will not complain about files for which
the user does not have write permission.
rm -rf /usr/example
RETURN VALUE
[NO_ERRS] Command completed without error.
[USAGE] Incorrect command line syntax. Execution
terminated.
[NP_WARN] An error warranting a warning message
occurred. Execution continues.
[NP_ERR] An error occurred that was not a system
error. Execution terminated.
[P_WARN] A system error occurred. Execution continues.
See intro(2) for more information on system
errors.
[P_ERR] A system error occurred. Execution
terminated. See intro(2) for more
information on system errors.
CAVEATS
When a file is busy (being executed), rm will ask if the
file is to be removed, even if the permissions are such that
the user has write permission. This applies to all users,
including the superuser.
Questions are printed on standard error. Therefore, when
redirecting standard error to a file, the -f option should
be used.
Recursive removes of directory structures of more than
NOFILE - 3 levels do not fail. In effect, rm can remove any
depth of directory structure.
SEE ALSO
rmdir(1), rmdir(2), unlink(2).
Printed 10/17/86 2
%%index%%
na:72,77;
sy:149,175;
de:324,1672;
op:1996,597;2737,43;
ex:2780,347;
rv:3127,792;
ca:3919,612;
se:4531,128;
%%index%%000000000141