xref: /original-bsd/bin/rm/rm.1 (revision 759cfe84)
1.\" Copyright (c) 1990, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" the Institute of Electrical and Electronics Engineers, Inc.
6.\"
7.\" %sccs.include.redist.roff%
8.\"
9.\"	@(#)rm.1	8.1 (Berkeley) 05/31/93
10.\"
11.Dd
12.Dt RM 1
13.Os
14.Sh NAME
15.Nm rm
16.Nd remove directory entries
17.Sh SYNOPSIS
18.Nm rm
19.Op Fl f | Fl i
20.Op Fl dRr
21.Ar file ...
22.Sh DESCRIPTION
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
28input device is a terminal, the user is prompted (on the standard error
29output) for confirmation.
30.Pp
31The options are as follows:
32.Bl -tag -width flag
33.It Fl d
34Attempt to remove directories as well as other types of files.
35.It Fl f
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.
45.It Fl i
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.
54.It Fl R
55Attempt to remove the file hierarchy rooted in each file argument.
56The
57.Fl R
58option implies the
59.Fl d
60option.
61If the
62.Fl i
63option is specified, the user is prompted for confirmation before
64each directory's contents are processed (as well as before the attempt
65is made to remove the directory).
66If the user does not respond affirmatively, the file hierarchy rooted in
67that directory is skipped.
68.Pp
69.It Fl r
70Equivalent to
71.Fl R .
72.El
73.Pp
74The
75.Nm rm
76utility removes symbolic links, not the files referenced by the links.
77.Pp
78It is an error to attempt to remove the files ``.'' and ``..''.
79.Pp
80The
81.Nm rm
82utility exits 0 if all of the named files or file hierarchies were removed,
83or if the
84.Fl f
85option was specified and all of the existing files or file hierarchies were
86removed.
87If an error occurs,
88.Nm rm
89exits with a value >0.
90.Sh SEE ALSO
91.Xr rmdir 1 ,
92.Xr unlink 2 ,
93.Xr fts 3 ,
94.Xr symlink 7
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
104.Bx
105implementations prompted on the standard output,
106not the standard error output.
107.Sh STANDARDS
108The
109.Nm rm
110command is expected to be
111.St -p1003.2
112compatible.
113