HP-UX Reference (11i v1 05/09) - 1 User Commands N-Z (vol 2)
r
rm(1) rm(1)
LC_ALL If set to a non-empty string value, overrides the values of all the other internationalization vari-
ables.
LC_CTYPE determines the interpretation of file names as single and/or multi-byte characters, the
classification of characters as printable, and the characters matched by character class expressions in regu-
lar expressions.
LC_MESSAGES determines the locale that should be used to affect the format and contents of diagnostic
messages written to standard error and informative messages written to standard output.
NLSPATH determines the location of message catalogues for the processing of
LC_MESSAGES .
International Code Set Support
Single- and multibyte character code sets are supported.
DIAGNOSTICS
Generally self-explanatory. Note that the
-f option does not suppress all diagnostic messages.
It is forbidden to remove the file
.., in order to avoid the consequences of using a command such as:
rm -r .*
If a designated file is a directory, an error comment is printed unless the -R or
-r option is used.
RETURN VALUE
rm exits with one of the following values:
0 If the -f option is not specified, 0 is returned only if all the named directory entries (the argu-
ments specified in the rm command) are removed.
If the -f option is specified, then all the existing named directory entries are removed. If any of
the named directory entries are non-existent,
rm still returns a zero.
>0 An error occurred.
EXAMPLES
Remove files with a prompt for verification:
rm -i file1 file2
Remove all the files in a directory:
rm -i mydirectory/*
Note that the previous command removes files only, and does not remove any directories in
mydirec-
tory
.
Remove a file in the current directory whose name starts with - or * or some other character that is spe-
cial to the shell:
rm ./-filename
rm \*filename
etc.
Remove a file in the current directory whose name starts with some strange (usually nonprinting, invisible)
character or perhaps has spaces at the beginning or end of the filename, prompting for confirmation:
rm -i *filename*
If *filename* is not unique in the directory, enter n when each of the other files is prompted.
A powerful and dangerous command to remove a directory is:
rm -fR directoryname
or
rm -Rf directoryname
which removes all files and directories from directoryname without any prompting for verification to
remove the files or the directories. This command should only be used when you are absolutely certain that
all the files and directories in directoryname as well as directoryname itself are to be removed.
Section 1−−842 Hewlett-Packard Company − 2 − HP-UX 11i Version 1: September 2005