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