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