1RM(1) User Commands RM(1)
2
3
4
6 rm - remove files or directories
7
9 rm [OPTION]... [FILE]...
10
12 This manual page documents the GNU version of rm. rm removes each
13 specified file. By default, it does not remove directories.
14
15 If the -I or --interactive=once option is given, and there are more
16 than three files or the -r, -R, or --recursive are given, then rm
17 prompts the user for whether to proceed with the entire operation. If
18 the response is not affirmative, the entire command is aborted.
19
20 Otherwise, if a file is unwritable, standard input is a terminal, and
21 the -f or --force option is not given, or the -i or --interac‐
22 tive=always option is given, rm prompts the user for whether to remove
23 the file. If the response is not affirmative, the file is skipped.
24
26 Remove (unlink) the FILE(s).
27
28 -f, --force
29 ignore nonexistent files and arguments, never prompt
30
31 -i prompt before every removal
32
33 -I prompt once before removing more than three files, or when
34 removing recursively; less intrusive than -i, while still giving
35 protection against most mistakes
36
37 --interactive[=WHEN]
38 prompt according to WHEN: never, once (-I), or always (-i);
39 without WHEN, prompt always
40
41 --one-file-system
42 when removing a hierarchy recursively, skip any directory that
43 is on a file system different from that of the corresponding
44 command line argument
45
46 --no-preserve-root
47 do not treat '/' specially
48
49 --preserve-root[=all]
50 do not remove '/' (default); with 'all', reject any command line
51 argument on a separate device from its parent
52
53 -r, -R, --recursive
54 remove directories and their contents recursively
55
56 -d, --dir
57 remove empty directories
58
59 -v, --verbose
60 explain what is being done
61
62 --help display this help and exit
63
64 --version
65 output version information and exit
66
67 By default, rm does not remove directories. Use the --recursive (-r or
68 -R) option to remove each listed directory, too, along with all of its
69 contents.
70
71 To remove a file whose name starts with a '-', for example '-foo', use
72 one of these commands:
73
74 rm -- -foo
75
76 rm ./-foo
77
78 Note that if you use rm to remove a file, it might be possible to
79 recover some of its contents, given sufficient expertise and/or time.
80 For greater assurance that the contents are truly unrecoverable, con‐
81 sider using shred.
82
84 Written by Paul Rubin, David MacKenzie, Richard M. Stallman, and Jim
85 Meyering.
86
88 GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
89 Report any translation bugs to <https://translationproject.org/team/>
90
92 Copyright © 2020 Free Software Foundation, Inc. License GPLv3+: GNU
93 GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
94 This is free software: you are free to change and redistribute it.
95 There is NO WARRANTY, to the extent permitted by law.
96
98 unlink(1), unlink(2), chattr(1), shred(1)
99
100 Full documentation <https://www.gnu.org/software/coreutils/rm>
101 or available locally via: info '(coreutils) rm invocation'
102
103
104
105GNU coreutils 8.32 April 2020 RM(1)