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