2004-11-03 13:51:07 +00:00
|
|
|
.\" Copyright Andries Brouwer, Ragnar Hojland Espinosa and A. Wik, 1998.
|
|
|
|
.\"
|
|
|
|
.\" This file may be copied under the conditions described
|
|
|
|
.\" in the LDP GENERAL PUBLIC LICENSE, Version 1, September 1998
|
|
|
|
.\" that should have been distributed together with this file.
|
|
|
|
.\"
|
|
|
|
.TH RM 1 1998-11 "GNU fileutils 4.0"
|
|
|
|
.SH NAME
|
|
|
|
rm \- remove files or directories
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.BI "rm [" options "] " file...
|
|
|
|
.sp
|
|
|
|
POSIX options:
|
|
|
|
.B "[\-fiRr] [\-\-]"
|
|
|
|
.sp
|
|
|
|
GNU options (shortest form):
|
|
|
|
.B [\-dfirvR]
|
|
|
|
.B "[\-\-help] [\-\-version] [\-\-]"
|
|
|
|
.SH DESCRIPTION
|
|
|
|
.B rm
|
|
|
|
removes each given
|
|
|
|
.IR 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
|
|
|
|
.I file
|
|
|
|
is either . or ..
|
|
|
|
(so as to avoid unpleasant surprises with `rm \-r .*' or so).
|
|
|
|
.PP
|
|
|
|
If the \-i option is given, or
|
|
|
|
if a file is unwritable, standard input is a terminal, and the
|
|
|
|
.B "\-f"
|
|
|
|
option is not given,
|
|
|
|
.B 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.
|
|
|
|
.SH "POSIX OPTIONS"
|
|
|
|
.TP
|
|
|
|
.B "\-f"
|
|
|
|
Do not prompt for confirmation. Do not write diagnostic messages.
|
|
|
|
Do not produce an error return status if the only errors were
|
2005-06-24 14:58:43 +00:00
|
|
|
non-existent files.
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B "\-i"
|
|
|
|
Prompt for confirmation.
|
|
|
|
(In case both \-f and \-i are given, the last one given takes effect.)
|
|
|
|
.TP
|
|
|
|
.BR "\-r" " or " "\-R"
|
|
|
|
Recursively remove directory trees.
|
|
|
|
.TP
|
|
|
|
.B "\-\-"
|
|
|
|
Terminate option list.
|
|
|
|
.SH "SVID DETAILS"
|
|
|
|
The System V Interface Definition forbids removal of the
|
|
|
|
last link to an executable binary file that is being executed.
|
|
|
|
.SH "GNU DETAILS"
|
|
|
|
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.)
|
|
|
|
.SH "GNU OPTIONS"
|
|
|
|
.TP
|
|
|
|
.B "\-d, \-\-directory"
|
|
|
|
Remove directories with
|
|
|
|
.BR unlink (2)
|
|
|
|
instead of
|
|
|
|
.BR 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
|
|
|
|
.BR fsck (8)
|
|
|
|
the filesystem after doing this.
|
|
|
|
.TP
|
|
|
|
.B "\-f, \-\-force"
|
|
|
|
Ignore nonexistent files and never prompt the user.
|
|
|
|
.TP
|
|
|
|
.B "\-i, \-\-interactive"
|
|
|
|
Prompt whether to remove each file. If the response is not affirmative,
|
|
|
|
the file is skipped.
|
|
|
|
.TP
|
|
|
|
.B "\-r, \-R, \-\-recursive"
|
|
|
|
Remove the contents of directories recursively.
|
|
|
|
.TP
|
|
|
|
.B "\-v, \-\-verbose"
|
|
|
|
Print the name of each file before removing it.
|
|
|
|
.SH "GNU STANDARD OPTIONS"
|
|
|
|
.TP
|
|
|
|
.B "\-\-help"
|
|
|
|
Print a usage message on standard output and exit successfully.
|
|
|
|
.TP
|
|
|
|
.B "\-\-version"
|
|
|
|
Print version information on standard output, then exit successfully.
|
|
|
|
.TP
|
|
|
|
.B "\-\-"
|
|
|
|
Terminate option list.
|
|
|
|
.SH ENVIRONMENT
|
|
|
|
The variables LANG, LC_ALL, LC_COLLATE, LC_CTYPE and LC_MESSAGES have the
|
|
|
|
usual meaning.
|
|
|
|
.SH "CONFORMING TO"
|
2006-08-03 13:57:13 +00:00
|
|
|
POSIX.2, except for the limitation on file hierarchy depth.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NOTES
|
|
|
|
This page describes
|
|
|
|
.B rm
|
|
|
|
as found in the fileutils-4.0 package;
|
|
|
|
other versions may differ slightly.
|
|
|
|
.LP
|
|
|
|
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 mini-Howto.
|