add whiteouts
[unix-history] / usr / src / bin / rm / rm.1
CommitLineData
60f2fa5e 1.\" Copyright (c) 1990, 1993, 1994
44c7b0e1 2.\" The Regents of the University of California. 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.\"
3d98c418 7.\" %sccs.include.redist.roff%
d1ca8f44 8.\"
edc4d417 9.\" @(#)rm.1 8.3 (Berkeley) %G%
b5dc1377
CL
10.\"
11.Dd
12.Dt RM 1
a22de7e6 13.Os
b5dc1377
CL
14.Sh NAME
15.Nm rm
16.Nd remove directory entries
17.Sh SYNOPSIS
18.Nm rm
3d98c418 19.Op Fl f | Fl i
edc4d417 20.Op Fl dPRrW
b5dc1377
CL
21.Ar file ...
22.Sh DESCRIPTION
7f9ef9cc
KB
23The
24.Nm rm
25utility attempts to remove the non-directory type files specified on the
26command line.
27If the permissions of the file do not permit writing, and the standard
307d7749
KB
28input device is a terminal, the user is prompted (on the standard error
29output) for confirmation.
b5dc1377 30.Pp
307d7749 31The options are as follows:
3d98c418
CL
32.Bl -tag -width flag
33.It Fl d
7f9ef9cc 34Attempt to remove directories as well as other types of files.
3d98c418 35.It Fl f
7f9ef9cc
KB
36Attempt to remove the files without prompting for confirmation,
37regardless of the file's permissions.
38If the file does not exist, do not display a diagnostic message or modify
39the exit status to reflect an error.
40The
41.Fl f
42option overrides any previous
43.Fl i
44options.
3d98c418 45.It Fl i
7f9ef9cc
KB
46Request confirmation before attempting to remove each file, regardless of
47the file's permissions, or whether or not the standard input device is a
48terminal.
49The
50.Fl i
51option overrides any previous
52.Fl f
53options.
60f2fa5e
KB
54.It Fl P
55Overwrite regular files before deleting them.
56Files are overwritten three times, first with the byte pattern 0xff,
57then 0x00, and then 0xff again, before they are deleted.
3d98c418 58.It Fl R
7f9ef9cc
KB
59Attempt to remove the file hierarchy rooted in each file argument.
60The
61.Fl R
62option implies the
63.Fl d
64option.
65If the
66.Fl i
67option is specified, the user is prompted for confirmation before
68each directory's contents are processed (as well as before the attempt
69is made to remove the directory).
70If the user does not respond affirmatively, the file hierarchy rooted in
71that directory is skipped.
b5dc1377 72.Pp
3d98c418 73.It Fl r
b5dc1377 74Equivalent to
5325ced3 75.Fl R .
edc4d417
JSP
76.It Fl W
77Removes a whiteout.
3d98c418 78.El
b5dc1377 79.Pp
b5dc1377
CL
80The
81.Nm rm
7f9ef9cc
KB
82utility removes symbolic links, not the files referenced by the links.
83.Pp
84It is an error to attempt to remove the files ``.'' and ``..''.
85.Pp
86The
87.Nm rm
307d7749
KB
88utility exits 0 if all of the named files or file hierarchies were removed,
89or if the
7f9ef9cc 90.Fl f
307d7749
KB
91option was specified and all of the existing files or file hierarchies were
92removed.
93If an error occurs,
94.Nm rm
95exits with a value >0.
b5dc1377 96.Sh SEE ALSO
7f9ef9cc 97.Xr rmdir 1 ,
7f9ef9cc 98.Xr unlink 2 ,
edc4d417 99.Xr unwhiteout 2 ,
0d17b9a2
KB
100.Xr fts 3 ,
101.Xr symlink 7
60f2fa5e
KB
102.Sh BUGS
103The
104.Fl P
105option assumes that the underlying file system is a fixed-block file
106system.
107UFS is a fixed-block file system, LFS is not.
108In addition, only regular files are overwritten, other types of files
109are not.
307d7749
KB
110.Sh COMPATIBILITY
111The
112.Nm rm
113utility differs from historical implementations in that the
114.Fl f
115option only masks attempts to remove non-existent files instead of
116masking a large variety of errors.
117.Pp
3d98c418
CL
118Also, historical
119.Bx
120implementations prompted on the standard output,
307d7749 121not the standard error output.
b5dc1377
CL
122.Sh STANDARDS
123The
124.Nm rm
3d98c418
CL
125command is expected to be
126.St -p1003.2
127compatible.