add POSIX/IEEE contribution notice
[unix-history] / usr / src / bin / rm / rm.1
CommitLineData
b5dc1377
CL
1.\" Copyright (c) 1990 The Regents of the University of California.
2.\" All rights reserved.
d1ca8f44 3.\"
ae122740
KB
4.\" This code is derived from software contributed to Berkeley by
5.\" the Institute of Electrical and Electronics Engineers, Inc.
6.\"
b5dc1377 7.\" %sccs.include.redist.man%
d1ca8f44 8.\"
ae122740 9.\" @(#)rm.1 6.8 (Berkeley) %G%
b5dc1377 10.\"
a22de7e6 11.Vx
b5dc1377
CL
12.Dd
13.Dt RM 1
a22de7e6 14.Os
b5dc1377
CL
15.Sh NAME
16.Nm rm
17.Nd remove directory entries
18.Sh SYNOPSIS
19.Nm rm
20.Op Fl f Li \&| Fl i
7f9ef9cc 21.Op Fl dRr
b5dc1377
CL
22.Ar file ...
23.Sh DESCRIPTION
7f9ef9cc
KB
24The
25.Nm rm
26utility attempts to remove the non-directory type files specified on the
27command line.
28If the permissions of the file do not permit writing, and the standard
307d7749
KB
29input device is a terminal, the user is prompted (on the standard error
30output) for confirmation.
b5dc1377 31.Pp
307d7749 32The options are as follows:
5325ced3 33.Tw 8n
7f9ef9cc
KB
34.Tp Fl d
35Attempt to remove directories as well as other types of files.
b5dc1377 36.Tp Fl f
7f9ef9cc
KB
37Attempt to remove the files without prompting for confirmation,
38regardless of the file's permissions.
39If the file does not exist, do not display a diagnostic message or modify
40the exit status to reflect an error.
41The
42.Fl f
43option overrides any previous
44.Fl i
45options.
b5dc1377 46.Tp Fl i
7f9ef9cc
KB
47Request confirmation before attempting to remove each file, regardless of
48the file's permissions, or whether or not the standard input device is a
49terminal.
50The
51.Fl i
52option overrides any previous
53.Fl f
54options.
b5dc1377 55.Tp Fl R
7f9ef9cc
KB
56Attempt to remove the file hierarchy rooted in each file argument.
57The
58.Fl R
59option implies the
60.Fl d
61option.
62If the
63.Fl i
64option is specified, the user is prompted for confirmation before
65each directory's contents are processed (as well as before the attempt
66is made to remove the directory).
67If the user does not respond affirmatively, the file hierarchy rooted in
68that directory is skipped.
b5dc1377
CL
69.Pp
70.Tp Fl r
71Equivalent to
5325ced3 72.Fl R .
b5dc1377
CL
73.Tp
74.Pp
b5dc1377
CL
75The
76.Nm rm
7f9ef9cc
KB
77utility removes symbolic links, not the files referenced by the links.
78.Pp
79It is an error to attempt to remove the files ``.'' and ``..''.
80.Pp
81The
82.Nm rm
307d7749
KB
83utility exits 0 if all of the named files or file hierarchies were removed,
84or if the
7f9ef9cc 85.Fl f
307d7749
KB
86option was specified and all of the existing files or file hierarchies were
87removed.
88If an error occurs,
89.Nm rm
90exits with a value >0.
b5dc1377 91.Sh SEE ALSO
7f9ef9cc 92.Xr rmdir 1 ,
7f9ef9cc
KB
93.Xr unlink 2 ,
94.Xr fts 3
307d7749
KB
95.Sh COMPATIBILITY
96The
97.Nm rm
98utility differs from historical implementations in that the
99.Fl f
100option only masks attempts to remove non-existent files instead of
101masking a large variety of errors.
102.Pp
103Also, historical BSD implementations prompted on the standard output,
104not the standard error output.
b5dc1377
CL
105.Sh STANDARDS
106The
107.Nm rm
108function is expected to be POSIX 1003.2 compatible.