Commit | Line | Data |
---|---|---|
b5dc1377 CL |
1 | .\" Copyright (c) 1990 The Regents of the University of California. |
2 | .\" All rights reserved. | |
d1ca8f44 | 3 | .\" |
ae122740 KB |
4 | .\" This code is derived from software contributed to Berkeley by |
5 | .\" the Institute of Electrical and Electronics Engineers, Inc. | |
6 | .\" | |
3d98c418 | 7 | .\" %sccs.include.redist.roff% |
d1ca8f44 | 8 | .\" |
0d17b9a2 | 9 | .\" @(#)rm.1 6.11 (Berkeley) %G% |
b5dc1377 CL |
10 | .\" |
11 | .Dd | |
12 | .Dt RM 1 | |
a22de7e6 | 13 | .Os |
b5dc1377 CL |
14 | .Sh NAME |
15 | .Nm rm | |
16 | .Nd remove directory entries | |
17 | .Sh SYNOPSIS | |
18 | .Nm rm | |
3d98c418 | 19 | .Op Fl f | Fl i |
7f9ef9cc | 20 | .Op Fl dRr |
b5dc1377 CL |
21 | .Ar file ... |
22 | .Sh DESCRIPTION | |
7f9ef9cc KB |
23 | The |
24 | .Nm rm | |
25 | utility attempts to remove the non-directory type files specified on the | |
26 | command line. | |
27 | If the permissions of the file do not permit writing, and the standard | |
307d7749 KB |
28 | input device is a terminal, the user is prompted (on the standard error |
29 | output) for confirmation. | |
b5dc1377 | 30 | .Pp |
307d7749 | 31 | The options are as follows: |
3d98c418 CL |
32 | .Bl -tag -width flag |
33 | .It Fl d | |
7f9ef9cc | 34 | Attempt to remove directories as well as other types of files. |
3d98c418 | 35 | .It Fl f |
7f9ef9cc KB |
36 | Attempt to remove the files without prompting for confirmation, |
37 | regardless of the file's permissions. | |
38 | If the file does not exist, do not display a diagnostic message or modify | |
39 | the exit status to reflect an error. | |
40 | The | |
41 | .Fl f | |
42 | option overrides any previous | |
43 | .Fl i | |
44 | options. | |
3d98c418 | 45 | .It Fl i |
7f9ef9cc KB |
46 | Request confirmation before attempting to remove each file, regardless of |
47 | the file's permissions, or whether or not the standard input device is a | |
48 | terminal. | |
49 | The | |
50 | .Fl i | |
51 | option overrides any previous | |
52 | .Fl f | |
53 | options. | |
3d98c418 | 54 | .It Fl R |
7f9ef9cc KB |
55 | Attempt to remove the file hierarchy rooted in each file argument. |
56 | The | |
57 | .Fl R | |
58 | option implies the | |
59 | .Fl d | |
60 | option. | |
61 | If the | |
62 | .Fl i | |
63 | option is specified, the user is prompted for confirmation before | |
64 | each directory's contents are processed (as well as before the attempt | |
65 | is made to remove the directory). | |
66 | If the user does not respond affirmatively, the file hierarchy rooted in | |
67 | that directory is skipped. | |
b5dc1377 | 68 | .Pp |
3d98c418 | 69 | .It Fl r |
b5dc1377 | 70 | Equivalent to |
5325ced3 | 71 | .Fl R . |
3d98c418 | 72 | .El |
b5dc1377 | 73 | .Pp |
b5dc1377 CL |
74 | The |
75 | .Nm rm | |
7f9ef9cc KB |
76 | utility removes symbolic links, not the files referenced by the links. |
77 | .Pp | |
78 | It is an error to attempt to remove the files ``.'' and ``..''. | |
79 | .Pp | |
80 | The | |
81 | .Nm rm | |
307d7749 KB |
82 | utility exits 0 if all of the named files or file hierarchies were removed, |
83 | or if the | |
7f9ef9cc | 84 | .Fl f |
307d7749 KB |
85 | option was specified and all of the existing files or file hierarchies were |
86 | removed. | |
87 | If an error occurs, | |
88 | .Nm rm | |
89 | exits with a value >0. | |
b5dc1377 | 90 | .Sh SEE ALSO |
7f9ef9cc | 91 | .Xr rmdir 1 , |
7f9ef9cc | 92 | .Xr unlink 2 , |
0d17b9a2 KB |
93 | .Xr fts 3 , |
94 | .Xr symlink 7 | |
307d7749 KB |
95 | .Sh COMPATIBILITY |
96 | The | |
97 | .Nm rm | |
98 | utility differs from historical implementations in that the | |
99 | .Fl f | |
100 | option only masks attempts to remove non-existent files instead of | |
101 | masking a large variety of errors. | |
102 | .Pp | |
3d98c418 CL |
103 | Also, historical |
104 | .Bx | |
105 | implementations prompted on the standard output, | |
307d7749 | 106 | not the standard error output. |
b5dc1377 CL |
107 | .Sh STANDARDS |
108 | The | |
109 | .Nm rm | |
3d98c418 CL |
110 | command is expected to be |
111 | .St -p1003.2 | |
112 | compatible. |