Open System Services Shell and Utilities Reference Manual (G06.28+, H06.05+)

User Commands (p - r) rm(1)
NAME
rm - Removes (unlinks) les or directories
SYNOPSIS
rm [-rR][-W NOG ][-W NOE ] le ...
FLAGS
-f Does not prompt before removing a le that does not have write permission set, and
does not display an error message if a specied le does not exist. If you specify both
the -f and -i ags when invoking the rm command, the ag that is specied last on the
command line takes effect.
-i Prompts you before deleting each le (interactive). When you use both the
-i and -r
ags, the rm command also asks if you want to examine directories. If you specify
both the -f and -i ags when invoking the rm command, the ag that is specied last on
the command line takes effect.
-r Permits recursive removal of directories and their contents.
-R Permits recursive removal of directories and their contents (same as -r).
HP Extensions
-W NOG Species that the /G directory should be omitted when the initial directory is root
and a recursive ag (-R or -r) is used. This ag is ignored when the initial direc-
tory is not /, /E,or/E/system or when recursion does not occur.
-W NOE Species that the /E directory should be omitted when the initial directory is root
and a recursive ag (-R or -r) is used. This ag is ignored when the initial direc-
tory is not root or when recursion does not occur.
Specify both the -W NOG and -W NOE ags to omit both the /G and /E directories.
DESCRIPTION
The rm command removes the entries for the specied les from a directory.
If the le argument is of the directory type, the following steps are taken:
1. If neither the -R or -r ag is specied, rm writes a diagnostic message to standard error,
does nothing further with the le le, and goes on to any remaining les.
2. If the -f ag is not specied and either of the following is true, rm writes a prompt to
standard error and reads a line from standard input:
The permissions of the le le do not permit writing, and standard input is a ter-
minal.
The -i ag is specied.
If the response is afrmative, rm does nothing further with the current le and goes on to
any remaining les. (The same actions are taken if the -f ag is specied and le is not
of the directory type.)
3. For each entry contained in the le le, other than . (dot) or .. (dot dot) entries. Steps 1
through 3 are taken with the entry as if it were a le argument.
If an entry is the last link to a le, it is destroyed. To remove a le, you must have write permis-
527188-007 Hewlett-Packard Company 753