rm removes each given file. By default, it does not remove
directories. But when the -r or -R option is given, the entire directory tree
below the specified directory is removed (and there are no limitations on the
depth of directory trees that can be removed by `rm -r'). It is an error when
the last path component of file is either . or .. (so as to avoid
unpleasant surprises with `rm -r .*' or so).
If the -i option is given, or if a file is unwritable, standard input is a
terminal, and the -f option is not given, rm prompts the user
for whether to remove the file, writing a question to stderr and reading an
answer from stdin. If the response is not affirmative, the file is skipped.
The GNU implementation (in fileutils-3.16) is broken in the sense that there is
an upper limit to the depth of hierarchies that can be removed. (If necessary,
a utility `deltree' can be used to remove very deep trees.)
Remove directories with unlink(2) instead of
rmdir(2), and don't require a directory to be empty before trying
to unlink it. Only works if you have appropriate privileges. Because
unlinking a directory causes any files in the deleted directory to become
unreferenced, it is wise to fsck(8) the filesystem after doing
Ignore nonexistent files and never prompt the user.
Prompt whether to remove each file. If the response is not
affirmative, the file is skipped.
This page describes rm as found in the fileutils-4.0 package; other
versions may differ slightly.
Sometimes one wishes to recover deleted files. It helps to have backups. It
helps to use a trash directory, so that removed files are only moved to the
trash. But actually removed files, although gone in principle, can sometimes
be recovered. For details for the ext2 filesystem, see the Ext2fs-Undeletion