rm(1) CLIX rm(1)
NAME
rm, erase, rmdir - Removes files or directories
SYNOPSIS
rm [-f] [-i] file ...
rm -r [-f] [-i] dirname ... [file ... ]
erase [-f] [-i] file ...
erase -r [-f] [-i] dirname ... [file ... ]
rmdir [-p] [-s] dirname ...
FLAGS
-f Removes all files (whether write-protected or not) in a directory
without prompting the user. In a write-protected directory, however,
files are never removed (regardless of their permissions), but no
messages are displayed. If the removal of a write-protected
directory was attempted, this flag could not suppress an error
message.
-r Causes any directories and subdirectories in the argument list to be
recursively removed. Files will be emptied from the directory and
the directory will be removed. Note that the user is normally
prompted for removal of any write-protected files the directory
contains. The write-protected files are removed without prompting,
however, if the -f flag is used or if stdin is not a terminal and the
-i flag is not used.
If the removal of a nonempty, write-protected directory is attempted,
the command will always fail (even if the -f flag is used), resulting
in an error message.
-i Confirms interactively the removal of any write-protected file. It
overrides the -f flag and remains in effect even if stdin is not a
terminal.
Two flags apply to rmdir:
-p Allows users to remove the directory dirname and its parent
directories that become empty. A message is displayed on stdout
telling whether the whole path is removed or part of the path remains
for some reason.
-s Suppress the message displayed on stderr when -p is in effect.
DESCRIPTION
2/94 - Intergraph Corporation 1
rm(1) CLIX rm(1)
The rm command removes the entries for one or more file(s) from a
directory. If an entry is the last link to the file, the file is
destroyed. If an entry is a symbolic link, removal of the link file
produces the same result as removal of an ordinary (``hard'') link.
However, if an entry is the file to which a symbolic link points, the file
is removed, but the link remains and points to nothing. 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 stdin is a terminal, the full set of
permissions (in octal) for the file are displayed, 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 stdin is not a terminal, the command will operate as if the
-f flag is in effect.
The erase command is the same as the rm command, except that it writes
NULL characters over the data before putting zeroes in the freed blocks
register.
The rmdir command removes the named directories, which must be empty.
EXAMPLES
1. Care should be taken when using the example that follows because it
removes files that are write protected without prompting the user. To
remove all files that the user owns or for which the user has write
permission in the current directory, assuming the directory is not
write protected, use the following:
rm -f .*
2. To recursively and interactively remove every file in the temp1
directory, enter the following:
rm -r -i temp1
3. To remove the temp1 directory (if it is empty), and its parent
directory, if it also becomes empty, use the following command line:
rmdir -p temp1
DIAGNOSTICS
All messages are generally self-explanatory.
Removing the files . and .. is forbidden to avoid the consequences of
2 Intergraph Corporation - 2/94
rm(1) CLIX rm(1)
inadvertently making the following type of mistake:
rm -r .*
EXIT VALUES
Both rm and rmdir return exit codes of 0 if all specified directories are
removed successfully. Otherwise, rm and rmdir return a nonzero exit code.
RELATED INFORMATION
Commands: ln(1)
Functions: unlink(2), rmdir(2)
2/94 - Intergraph Corporation 3