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