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