xref: /original-bsd/bin/rm/rm.1 (revision dd262573)
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.5 (Berkeley) 12/08/90
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 for confirmation.
26.Pp
27The following options are available:
28.Tw 8n
29.Tp Fl d
30Attempt to remove directories as well as other types of files.
31.Tp Fl f
32Attempt to remove the files without prompting for confirmation,
33regardless of the file's permissions.
34If the file does not exist, do not display a diagnostic message or modify
35the exit status to reflect an error.
36The
37.Fl f
38option overrides any previous
39.Fl i
40options.
41.Tp Fl i
42Request confirmation before attempting to remove each file, regardless of
43the file's permissions, or whether or not the standard input device is a
44terminal.
45The
46.Fl i
47option overrides any previous
48.Fl f
49options.
50.Tp Fl R
51Attempt to remove the file hierarchy rooted in each file argument.
52The
53.Fl R
54option implies the
55.Fl d
56option.
57If the
58.Fl i
59option is specified, the user is prompted for confirmation before
60each directory's contents are processed (as well as before the attempt
61is made to remove the directory).
62If the user does not respond affirmatively, the file hierarchy rooted in
63that directory is skipped.
64.Pp
65.Tp Fl r
66Equivalent to
67.Fl R .
68.Tp
69.Pp
70The following argument is available:
71.Tw Fl
72.Tp Ar file
73A pathname of a directory entry to be removed.
74.Tp
75.Pp
76The
77.Nm rm
78utility removes symbolic links, not the files referenced by the links.
79.Pp
80It is an error to attempt to remove the files ``.'' and ``..''.
81.Pp
82The
83.Nm rm
84utility exits with one of the following values:
85.Tw Ds
86.Tp Li 0
87All the named files were removed or the
88.Fl f
89option was specified and some of the directory entries did not exist.
90.Tp Li >0
91An error occurred.
92.Tp
93.Sh SEE ALSO
94.Xr rmdir 1 ,
95.Xr stat 2 ,
96.Xr unlink 2 ,
97.Xr fts 3
98.Sh STANDARDS
99The
100.Nm rm
101function is expected to be POSIX 1003.2 compatible.
102