RM(1) — USER COMMANDS
NAME
rm, rmdir − remove (unlink) files or directories
SYNOPSIS
rm [ −f ] [ −r ] [ −i ] [ − ] file ...
rmdir dir ...
DESCRIPTION
rm.1:.IX "rm command" "" "rm — remove file or directory" rm.1:.IX "remove file or directory" "" "remove file or directory — rm" rm.1:.IX "delete file or directory" "" "delete file or directory — rm" Rm removes the directory entries for one or more files. If an entry was the last link to the file, the file is destroyed. Rm −r and rmdir remove entries for directories.
To remove a file, you must have write permission in its directory; but you don’t need read or write permission on the file itself. If you don’t have write permission on the file and the standard input is a terminal, rm displays the file’s permissions and waits for you to type in a response. If your response begins with ‘y’ the file is deleted; otherwise the file is left alone.
To remove a full directory, use rm with the −r option (see below). Rmdir removes the named directory only if it is empty.
OPTIONS
The following are options for rm:
−fForce files to be removed, without displaying permissions, asking questions, or reporting errors.
−rRecursively delete the entire contents of the specified directory and the directory itself.
−iAsk whether to delete each file, or, under −r, whether to examine each directory. Sometimes called the interactive option.
−Treat all the following arguments as filenames — so that you can specify filenames starting with a minus.
WARNING
It is forbidden to remove the file ‘..’ merely to avoid the antisocial consequences of inadvertently doing something like ‘rm −r .∗’.
SEE ALSO
Sun Release 2.0 — Last change: 2 November 1983