| 1 | .TH RM 1 |
| 2 | .SH NAME |
| 3 | rm, rmdir \- remove (unlink) files |
| 4 | .SH SYNOPSIS |
| 5 | .B rm |
| 6 | [ |
| 7 | .B \-fri |
| 8 | ] file ... |
| 9 | .PP |
| 10 | .B rmdir |
| 11 | dir ... |
| 12 | .PP |
| 13 | .SH DESCRIPTION |
| 14 | .I Rm |
| 15 | removes the entries for one or more |
| 16 | files |
| 17 | from a directory. |
| 18 | If an entry was the last link to the file, the file |
| 19 | is destroyed. |
| 20 | Removal of a file requires write permission in its directory, |
| 21 | but neither read nor write permission on the file itself. |
| 22 | .PP |
| 23 | If a file has no write permission |
| 24 | and the standard input is a terminal, |
| 25 | its permissions are printed and a line is read from |
| 26 | the standard input. |
| 27 | If that line begins with `y' the file is deleted, |
| 28 | otherwise the file remains. |
| 29 | No questions are asked |
| 30 | when the |
| 31 | .B \-f |
| 32 | (force) option is given. |
| 33 | .PP |
| 34 | If a designated file is a directory, |
| 35 | an error comment is printed unless the optional |
| 36 | argument |
| 37 | .B \-r |
| 38 | has been used. |
| 39 | In that case, |
| 40 | .I rm |
| 41 | recursively deletes the |
| 42 | entire contents of the specified directory, |
| 43 | and the directory itself. |
| 44 | .PP |
| 45 | If the |
| 46 | .B \-i |
| 47 | (interactive) option is in effect, |
| 48 | .I rm |
| 49 | asks whether to delete each file, |
| 50 | and, under |
| 51 | .BR \-r , |
| 52 | whether to examine each directory. |
| 53 | .PP |
| 54 | .I Rmdir |
| 55 | removes entries for the named directories, |
| 56 | which must be empty. |
| 57 | .SH "SEE ALSO" |
| 58 | unlink(2) |
| 59 | .SH DIAGNOSTICS |
| 60 | Generally self-explanatory. |
| 61 | It is forbidden to remove the file `..' merely to avoid the |
| 62 | antisocial consequences of inadvertently doing something like |
| 63 | `rm \-r .*'. |