Commit | Line | Data |
---|---|---|
d1ca8f44 KM |
1 | .\" Copyright (c) 1980 Regents of the University of California. |
2 | .\" All rights reserved. The Berkeley software License Agreement | |
3 | .\" specifies the terms and conditions for redistribution. | |
4 | .\" | |
3d66c421 | 5 | .\" @(#)rm.1 6.2 (Berkeley) %G% |
d1ca8f44 | 6 | .\" |
a48f5679 | 7 | .TH RM 1 "" |
d1ca8f44 KM |
8 | .UC 4 |
9 | .SH NAME | |
7866e115 | 10 | rm, rmdir \- remove (unlink) files or directories |
d1ca8f44 KM |
11 | .SH SYNOPSIS |
12 | .B rm | |
13 | [ | |
14 | .B \-f | |
15 | ] [ | |
16 | .B \-r | |
17 | ] [ | |
18 | .B \-i | |
d1ca8f44 KM |
19 | ] file ... |
20 | .PP | |
21 | .B rmdir | |
22 | dir ... | |
23 | .PP | |
24 | .SH DESCRIPTION | |
25 | .I Rm | |
7866e115 KM |
26 | removes the entries for one or more files from a directory. |
27 | If an entry was the last link to the file, the file is destroyed. | |
d1ca8f44 KM |
28 | Removal of a file requires write permission in its directory, |
29 | but neither read nor write permission on the file itself. | |
30 | .PP | |
7866e115 KM |
31 | If a file has no write permission and the standard input is a terminal, |
32 | its permissions are printed and a line is read from the standard input. | |
33 | If that line begins with `y' the file is deleted, otherwise the file remains. | |
34 | No questions are asked and no errors are reported when the | |
d1ca8f44 KM |
35 | .B \-f |
36 | (force) option is given. | |
37 | .PP | |
38 | If a designated file is a directory, | |
7866e115 | 39 | an error comment is printed unless the optional argument |
d1ca8f44 | 40 | .B \-r |
7866e115 | 41 | has been used. In that case, |
d1ca8f44 | 42 | .I rm |
7866e115 | 43 | recursively deletes the entire contents of the specified directory, |
d1ca8f44 KM |
44 | and the directory itself. |
45 | .PP | |
46 | If the | |
47 | .B \-i | |
48 | (interactive) option is in effect, | |
49 | .I rm | |
7866e115 | 50 | asks whether to delete each file, and, under |
d1ca8f44 KM |
51 | .BR \-r , |
52 | whether to examine each directory. | |
53 | .PP | |
3d66c421 KB |
54 | Since getopt recognizes the string ``--'' as terminating the set |
55 | of options, it can be used to allow the removal of file names | |
56 | starting with a dash. | |
d1ca8f44 KM |
57 | .PP |
58 | .I Rmdir | |
7866e115 | 59 | removes entries for the named directories, which must be empty. |
d1ca8f44 | 60 | .SH "SEE ALSO" |
7866e115 | 61 | rm(1), unlink(2), rmdir(2) |