| 1 |
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.50.1. |
| 2 |
.TH RM "1" "February 2026" "GNU coreutils 9.10" "User Commands" |
| 3 |
.SH NAME |
| 4 |
rm \- remove files or directories |
| 5 |
.SH SYNOPSIS |
| 6 |
.B rm |
| 7 |
[\fI\,OPTION\/\fR]... [\fI\,FILE\/\fR]... |
| 8 |
.SH DESCRIPTION |
| 9 |
This manual page |
| 10 |
documents the GNU version of |
| 11 |
.BR rm . |
| 12 |
.B rm |
| 13 |
removes each specified file. By default, it does not remove |
| 14 |
directories. |
| 15 |
.P |
| 16 |
If the \fI\-I\fR or \fI\-\-interactive=once\fR option is given, |
| 17 |
and there are more than three files or the \fI\-r\fR, \fI\-R\fR, |
| 18 |
or \fI\-\-recursive\fR are given, then |
| 19 |
.B rm |
| 20 |
prompts the user for whether to proceed with the entire operation. If |
| 21 |
the response is not affirmative, the entire command is aborted. |
| 22 |
.P |
| 23 |
Otherwise, if a file is unwritable, standard input is a terminal, and |
| 24 |
the \fI\-f\fR or \fI\-\-force\fR option is not given, or the |
| 25 |
\fI\-i\fR or \fI\-\-interactive=always\fR option is given, |
| 26 |
.B rm |
| 27 |
prompts the user for whether to remove the file. If the response is |
| 28 |
not affirmative, the file is skipped. |
| 29 |
.SH OPTIONS |
| 30 |
.PP |
| 31 |
Remove (unlink) the FILE(s). |
| 32 |
.TP |
| 33 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#rm-f'\fB\-f, \-\-force\fP\X'tty: link' |
| 34 |
ignore nonexistent files and arguments, never prompt |
| 35 |
.TP |
| 36 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#rm-i'\fB\-i\fP\X'tty: link' |
| 37 |
prompt before every removal |
| 38 |
.TP |
| 39 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#rm-I'\fB\-I\fP\X'tty: link' |
| 40 |
prompt once before removing more than three files, |
| 41 |
or when removing recursively; less intrusive than \fB\-i\fR, |
| 42 |
while still giving protection against most mistakes |
| 43 |
.TP |
| 44 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#rm--interactive'\fB\-\-interactive[=WHEN]\fP\X'tty: link' |
| 45 |
prompt according to WHEN: never, once (\fB\-I\fR), or always (\fB\-i\fR); |
| 46 |
without WHEN, prompt always |
| 47 |
.TP |
| 48 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#rm--one-file-system'\fB\-\-one\-file\-system\fP\X'tty: link' |
| 49 |
when removing a hierarchy recursively, |
| 50 |
skip any directory that is on a file system different |
| 51 |
from that of the corresponding command line argument |
| 52 |
.TP |
| 53 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#rm--no-preserve-root'\fB\-\-no\-preserve\-root\fP\X'tty: link' |
| 54 |
do not treat '/' specially |
| 55 |
.TP |
| 56 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#rm--preserve-root'\fB\-\-preserve\-root[=all]\fP\X'tty: link' |
| 57 |
do not remove '/' (default); |
| 58 |
with 'all', reject any command line argument |
| 59 |
on a separate device from its parent |
| 60 |
.TP |
| 61 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#rm-r'\fB\-r, \-R, \-\-recursive\fP\X'tty: link' |
| 62 |
remove directories and their contents recursively |
| 63 |
.TP |
| 64 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#rm-d'\fB\-d, \-\-dir\fP\X'tty: link' |
| 65 |
remove empty directories |
| 66 |
.TP |
| 67 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#rm-v'\fB\-v, \-\-verbose\fP\X'tty: link' |
| 68 |
explain what is being done |
| 69 |
.TP |
| 70 |
\X'tty: link https://www.gnu.org/software/coreutils/rm#rm--help'\fB\-\-help\fP\X'tty: link' |
| 71 |
display this help and exit |
| 72 |
.TP |
| 73 |
\X'tty: link https://www.gnu.org/software/coreutils/rm#rm--version'\fB\-\-version\fP\X'tty: link' |
| 74 |
output version information and exit |
| 75 |
.PP |
| 76 |
By default, rm does not remove directories. Use the \fB\-\-recursive\fR (\fB\-r\fR or \fB\-R\fR) |
| 77 |
option to remove each listed directory, too, along with all of its contents. |
| 78 |
.PP |
| 79 |
Any attempt to remove a file whose last file name component is '.' or '..' |
| 80 |
is rejected with a diagnostic. |
| 81 |
.PP |
| 82 |
To remove a file whose name starts with a '\-', for example '\-foo', |
| 83 |
use one of these commands: |
| 84 |
.IP |
| 85 |
rm \fB\-\-\fR \fB\-foo\fR |
| 86 |
.IP |
| 87 |
rm ./\-foo |
| 88 |
.PP |
| 89 |
If you use rm to remove a file, it might be possible to recover |
| 90 |
some of its contents, given sufficient expertise and/or time. For greater |
| 91 |
assurance that the contents are unrecoverable, consider using \fBshred\fP(1). |
| 92 |
.SH AUTHOR |
| 93 |
Written by Paul Rubin, David MacKenzie, Richard M. Stallman, |
| 94 |
and Jim Meyering. |
| 95 |
.SH "REPORTING BUGS" |
| 96 |
Report bugs to: bug\[email protected] |
| 97 |
.br |
| 98 |
GNU coreutils home page: <https://www.gnu.org/software/coreutils/> |
| 99 |
.br |
| 100 |
General help using GNU software: <https://www.gnu.org/gethelp/> |
| 101 |
.br |
| 102 |
Report any translation bugs to <https://translationproject.org/team/> |
| 103 |
.SH "SEE ALSO" |
| 104 |
\fBunlink\fP(1), \fBunlink\fP(2), \fBchattr\fP(1), \fBshred\fP(1) |
| 105 |
.PP |
| 106 |
.br |
| 107 |
Full documentation <https://www.gnu.org/software/coreutils/rm> |
| 108 |
.br |
| 109 |
or available locally via: info \(aq(coreutils) rm invocation\(aq |
| 110 |
.PP |
| 111 |
.br |
| 112 |
Packaged by Debian (9.10\-1) |
| 113 |
.br |
| 114 |
Copyright \(co 2026 Free Software Foundation, Inc. |
| 115 |
.br |
| 116 |
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. |
| 117 |
.br |
| 118 |
This is free software: you are free to change and redistribute it. |
| 119 |
.br |
| 120 |
There is NO WARRANTY, to the extent permitted by law. |