Linux "rm" Command Line Options and Examples
remove files or directories

This manual page documents the GNU version of rm. rm removes each specified file. By default, it does not remove directories.


Usage:

rm [OPTION]... [FILE]...






Command Line Options:

-f
ignore nonexistent files and arguments, never prompt
rm -f ...
-i
prompt before every removal
rm -i ...
-I
prompt once before removing more than three files, or when removing recursively; less intrusive than
rm -I ...
--interactive[
prompt according to WHEN: never, once (-I), or always (-i); without WHEN, prompt always
rm --interactive[ ...
--one-file-system
when removing a hierarchy recursively, skip any directory that is on a file system different from thatof the corresponding command line argument
rm --one-file-system ...
--no-preserve-root
do not treat '/' specially
rm --no-preserve-root ...
--preserve-root
do not remove '/' (default)
rm --preserve-root ...
-r
remove directories and their contents recursively
rm -r ...
-d
remove empty directories
rm -d ...
-v
explain what is being done
rm -v ...
--help
display this help and exit
rm --help ...
--version
output version information and exitBy default, rm does not remove directories. Use the --recursive (-r or -R) option to remove each listeddirectory, too, along with all of its contents.To remove a file whose name starts with a '-', for example '-foo', use one of these commands:rm -- -foorm ./-fooNote that if you use rm to remove a file, it might be possible to recover some of its contents, given suffi‐cient expertise and/or time. For greater assurance that the contents are truly unrecoverable, consider usingshred.AUTHORWritten by Paul Rubin, David MacKenzie, Richard M. Stallman, and Jim Meyering.REPORTING BUGSGNU coreutils online help: <http://www.gnu.org/software/coreutils/>Report rm translation bugs to <http://translationproject.org/team/>COPYRIGHTCopyright © 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later<http://gnu.org/licenses/gpl.html>.This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent per‐mitted by law.
rm --version ...