RM
Section: User Commands (1)
Updated: February 2026
Index
Return to Main Contents
NAME
rm - remove files or directories
SYNOPSIS
rm
[
,OPTION/]... [
,FILE/]...
DESCRIPTION
This manual page
documents the GNU version of
rm.
rm
removes each specified file. By default, it does not remove
directories.
If the
-I or
--interactive=once option is given,
and there are more than three files or the
-r,
-R,
or
--recursive are given, then
rm
prompts the user for whether to proceed with the entire operation. If
the response is not affirmative, the entire command is aborted.
Otherwise, if a file is unwritable, standard input is a terminal, and
the
-f or
--force option is not given, or the
-i or
--interactive=always option is given,
rm
prompts the user for whether to remove the file. If the response is
not affirmative, the file is skipped.
OPTIONS
Remove (unlink) the FILE(s).
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#r-f'-f, --forceX'tty: link'
-
ignore nonexistent files and arguments, never prompt
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#r-i'-iX'tty: link'
-
prompt before every removal
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#r-I'-IX'tty: link'
-
prompt once before removing more than three files,
or when removing recursively; less intrusive than -i,
while still giving protection against most mistakes
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#r-interactive'--interactive[=WHEN]X'tty: link'
-
prompt according to WHEN: never, once (-I), or always (-i);
without WHEN, prompt always
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#r-on-fil-system'--one-file-systemX'tty: link'
-
when removing a hierarchy recursively,
skip any directory that is on a file system different
from that of the corresponding command line argument
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#r-n-preserv-root'--no-preserve-rootX'tty: link'
-
do not treat '/' specially
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#r-preserv-root'--preserve-root[=all]X'tty: link'
-
do not remove '/' (default);
with 'all', reject any command line argument
on a separate device from its parent
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#r-r'-r, -R, --recursiveX'tty: link'
-
remove directories and their contents recursively
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#r-d'-d, --dirX'tty: link'
-
remove empty directories
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#r-v'-v, --verboseX'tty: link'
-
explain what is being done
- X'tty: link https://www.gnu.org/software/coreutils/rm#r-help'--helpX'tty: link'
-
display this help and exit
- X'tty: link https://www.gnu.org/software/coreutils/rm#r-version'--versionX'tty: link'
-
output version information and exit
By default, rm does not remove directories. Use the --recursive (-r or -R)
option to remove each listed directory, too, along with all of its contents.
Any attempt to remove a file whose last file name component is '.' or '..'
is rejected with a diagnostic.
To remove a file whose name starts with a '-', for example '-foo',
use one of these commands:
-
rm -- -foo
-
rm ./-foo
If you use rm to remove a file, it might be possible to recover
some of its contents, given sufficient expertise and/or time. For greater
assurance that the contents are unrecoverable, consider using shred(1).
AUTHOR
Written by Paul Rubin, David MacKenzie, Richard M. Stallman,
and Jim Meyering.
REPORTING BUGS
Report bugs to:
bug-coreutils@gnu.org
Report Gentoo bugs to: https://bugs.gentoo.org/
GNU coreutils home page: <https://www.gnu.org/software/coreutils/>
General help using GNU software: <https://www.gnu.org/gethelp/>
Report any translation bugs to <https://translationproject.org/team/>
SEE ALSO
unlink(1),
unlink(2),
chattr(1),
shred(1)
Full documentation <https://www.gnu.org/software/coreutils/rm>
or available locally via: info aq(coreutils) rm invocationaq
Packaged by Gentoo (9.10 (p0))
Copyright © 2026 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- OPTIONS
-
- AUTHOR
-
- REPORTING BUGS
-
- SEE ALSO
-