rm(1) rm(1)
NAME
rm - remove files
SYNOPSIS
rm [option ...] file ...
DESCRIPTION
rm removes the entry (link) for one or more files from a directory.
You must have write permission for a directory before you can remove a
file from it.
OPTIONS
No option specified:
If you have write permission for file, rm removes the entry
without issuing a warning.
If you do not have write permission for file and the standard
input is a terminal, rm prompts you by displaying the permissions
and a query ? and asking whether you want the file to be deleted.
The entry is not deleted unless you answer the locale's
equivalent of yes. No such confirmation is requested if the stan-
dard input is not a terminal.
-f Removes the entries without any questions. Files will not be
removed if you do not have write permission for the directory.
-r or -R
Accepts a directory name as an argument for file. The usual error
message is not issued. rm recursively deletes the entire contents
of the directory and also removes the directory itself.
You cannot remove the parent directory (..) in this way. Symbolic
links that are encountered with this option are not traversed.
If the removal of a non-empty, write-protected directory is
attempted, the command will always fail (even if the -f option is
used), resulting in an error message.
-i rm removes files interactively, requesting confirmation for each
write-protected file (or directory, if -r or -R is in effect)
before removing it.
The -i option overrides the -f option and remains in effect even
if the standard input is not a terminal.
-- Two dashes explicitly mark the end of command-line options when
there are file name arguments which begin with a dash.
file Name of the file that is to be removed. If you include the -r or
-R option, file may also be a directory. You can include a number
of file/directory arguments.
Page 1 Reliant UNIX 5.44 Printed 11/98
rm(1) rm(1)
If you specify a file that has several links, only the specified
link is removed; the file itself remains intact (the link counter
is decremented by one). The file itself is not deleted until you
remove the final link.
You must have write permission for the directory before you can
remove a file from it; but you need not have read or write per-
mission for the file itself.
LOCALE
The LCMESSAGES environment variable governs the language in which
message texts are displayed. If LCMESSAGES is undefined or is defined
as the null string, it defaults to the value of LANG. If LANG is like-
wise undefined or null, the system acts as if it were not internation-
alized.
The LCALL environment variable governs the entire locale. LCALL
takes precedence over all the other environment variables which affect
internationalization.
Answers to yes/no queries must be given in the language appropriate to
the current locale.
EXAMPLES
Example 1
Removal of all files that end in prog with confirmation:
$ rm -i *.prog
exec.prog:? (y/n) y
code.prog:? (y/n) yuppie
input.prog:? (y/n) n
lucky.prog:? (y/n) no
a.prog:? (y/n) tomorrow
$
The links to files exec.prog and code.prog are removed; the others are
retained.
Example 2
Removal of the directory norm with all files and subdirectories:
$ rm -r norm
SEE ALSO
rmdir(1), unlink(2), remove(3C).
Page 2 Reliant UNIX 5.44 Printed 11/98