| 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 | .\" |
| 5 | .\" @(#)rm.1 4.1 (Berkeley) %G% |
| 6 | .\" |
| 7 | .TH RM 1 4/1/81 |
| 8 | .UC 4 |
| 9 | .SH NAME |
| 10 | rm, rmdir \- remove (unlink) files |
| 11 | .SH SYNOPSIS |
| 12 | .B rm |
| 13 | [ |
| 14 | .B \-f |
| 15 | ] [ |
| 16 | .B \-r |
| 17 | ] [ |
| 18 | .B \-i |
| 19 | ] [ |
| 20 | .B \- |
| 21 | ] file ... |
| 22 | .PP |
| 23 | .B rmdir |
| 24 | dir ... |
| 25 | .PP |
| 26 | .SH DESCRIPTION |
| 27 | .I Rm |
| 28 | removes the entries for one or more |
| 29 | files |
| 30 | from a directory. |
| 31 | If an entry was the last link to the file, the file |
| 32 | is destroyed. |
| 33 | Removal of a file requires write permission in its directory, |
| 34 | but neither read nor write permission on the file itself. |
| 35 | .PP |
| 36 | If a file has no write permission |
| 37 | and the standard input is a terminal, |
| 38 | its permissions are printed and a line is read from |
| 39 | the standard input. |
| 40 | If that line begins with `y' the file is deleted, |
| 41 | otherwise the file remains. |
| 42 | No questions are asked |
| 43 | and no errors are reported |
| 44 | when the |
| 45 | .B \-f |
| 46 | (force) option is given. |
| 47 | .PP |
| 48 | If a designated file is a directory, |
| 49 | an error comment is printed unless the optional |
| 50 | argument |
| 51 | .B \-r |
| 52 | has been used. |
| 53 | In that case, |
| 54 | .I rm |
| 55 | recursively deletes the |
| 56 | entire contents of the specified directory, |
| 57 | and the directory itself. |
| 58 | .PP |
| 59 | If the |
| 60 | .B \-i |
| 61 | (interactive) option is in effect, |
| 62 | .I rm |
| 63 | asks whether to delete each file, |
| 64 | and, under |
| 65 | .BR \-r , |
| 66 | whether to examine each directory. |
| 67 | .PP |
| 68 | The null option |
| 69 | .B \- |
| 70 | indicates that all the arguments following it are to be treated as |
| 71 | file names. This allows the specification of file names starting with |
| 72 | a minus. |
| 73 | .PP |
| 74 | .I Rmdir |
| 75 | removes entries for the named directories, |
| 76 | which must be empty. |
| 77 | .SH "SEE ALSO" |
| 78 | unlink(2) |
| 79 | .SH DIAGNOSTICS |
| 80 | Generally self-explanatory. |
| 81 | It is forbidden to remove the file `..' merely to avoid the |
| 82 | antisocial consequences of inadvertently doing something like |
| 83 | `rm \-r .*'. |