xref: /csrg-svn/bin/rm/rm.1 (revision 66860)
1*66860Sbostic.\" Copyright (c) 1990, 1993, 1994
260690Sbostic.\"	The Regents of the University of California.  All rights reserved.
319282Smckusick.\"
450204Sbostic.\" This code is derived from software contributed to Berkeley by
550204Sbostic.\" the Institute of Electrical and Electronics Engineers, Inc.
650204Sbostic.\"
750625Scael.\" %sccs.include.redist.roff%
819282Smckusick.\"
9*66860Sbostic.\"	@(#)rm.1	8.2 (Berkeley) 04/18/94
1043084Scael.\"
1143084Scael.Dd
1243084Scael.Dt RM 1
1347426Scael.Os
1443084Scael.Sh NAME
1543084Scael.Nm rm
1643084Scael.Nd remove directory entries
1743084Scael.Sh SYNOPSIS
1843084Scael.Nm rm
1950625Scael.Op Fl f | Fl i
20*66860Sbostic.Op Fl dPRr
2143084Scael.Ar file ...
2243084Scael.Sh DESCRIPTION
2345769SbosticThe
2445769Sbostic.Nm rm
2545769Sbosticutility attempts to remove the non-directory type files specified on the
2645769Sbosticcommand line.
2745769SbosticIf the permissions of the file do not permit writing, and the standard
2847195Sbosticinput device is a terminal, the user is prompted (on the standard error
2947195Sbosticoutput) for confirmation.
3043084Scael.Pp
3147195SbosticThe options are as follows:
3250625Scael.Bl -tag -width flag
3350625Scael.It Fl d
3445769SbosticAttempt to remove directories as well as other types of files.
3550625Scael.It Fl f
3645769SbosticAttempt to remove the files without prompting for confirmation,
3745769Sbosticregardless of the file's permissions.
3845769SbosticIf the file does not exist, do not display a diagnostic message or modify
3945769Sbosticthe exit status to reflect an error.
4045769SbosticThe
4145769Sbostic.Fl f
4245769Sbosticoption overrides any previous
4345769Sbostic.Fl i
4445769Sbosticoptions.
4550625Scael.It Fl i
4645769SbosticRequest confirmation before attempting to remove each file, regardless of
4745769Sbosticthe file's permissions, or whether or not the standard input device is a
4845769Sbosticterminal.
4945769SbosticThe
5045769Sbostic.Fl i
5145769Sbosticoption overrides any previous
5245769Sbostic.Fl f
5345769Sbosticoptions.
54*66860Sbostic.It Fl P
55*66860SbosticOverwrite regular files before deleting them.
56*66860SbosticFiles are overwritten three times, first with the byte pattern 0xff,
57*66860Sbosticthen 0x00, and then 0xff again, before they are deleted.
5850625Scael.It Fl R
5945769SbosticAttempt to remove the file hierarchy rooted in each file argument.
6045769SbosticThe
6145769Sbostic.Fl R
6245769Sbosticoption implies the
6345769Sbostic.Fl d
6445769Sbosticoption.
6545769SbosticIf the
6645769Sbostic.Fl i
6745769Sbosticoption is specified, the user is prompted for confirmation before
6845769Sbosticeach directory's contents are processed (as well as before the attempt
6945769Sbosticis made to remove the directory).
7045769SbosticIf the user does not respond affirmatively, the file hierarchy rooted in
7145769Sbosticthat directory is skipped.
7243084Scael.Pp
7350625Scael.It Fl r
7443084ScaelEquivalent to
7544957Scael.Fl R .
7650625Scael.El
7743084Scael.Pp
7843084ScaelThe
7943084Scael.Nm rm
8045769Sbosticutility removes symbolic links, not the files referenced by the links.
8145769Sbostic.Pp
8245769SbosticIt is an error to attempt to remove the files ``.'' and ``..''.
8345769Sbostic.Pp
8445769SbosticThe
8545769Sbostic.Nm rm
8647195Sbosticutility exits 0 if all of the named files or file hierarchies were removed,
8747195Sbosticor if the
8845769Sbostic.Fl f
8947195Sbosticoption was specified and all of the existing files or file hierarchies were
9047195Sbosticremoved.
9147195SbosticIf an error occurs,
9247195Sbostic.Nm rm
9347195Sbosticexits with a value >0.
9443084Scael.Sh SEE ALSO
9545769Sbostic.Xr rmdir 1 ,
9645769Sbostic.Xr unlink 2 ,
9755730Sbostic.Xr fts 3 ,
9855730Sbostic.Xr symlink 7
99*66860Sbostic.Sh BUGS
100*66860SbosticThe
101*66860Sbostic.Fl P
102*66860Sbosticoption assumes that the underlying file system is a fixed-block file
103*66860Sbosticsystem.
104*66860SbosticUFS is a fixed-block file system, LFS is not.
105*66860SbosticIn addition, only regular files are overwritten, other types of files
106*66860Sbosticare not.
10747195Sbostic.Sh COMPATIBILITY
10847195SbosticThe
10947195Sbostic.Nm rm
11047195Sbosticutility differs from historical implementations in that the
11147195Sbostic.Fl f
11247195Sbosticoption only masks attempts to remove non-existent files instead of
11347195Sbosticmasking a large variety of errors.
11447195Sbostic.Pp
11550625ScaelAlso, historical
11650625Scael.Bx
11750625Scaelimplementations prompted on the standard output,
11847195Sbosticnot the standard error output.
11943084Scael.Sh STANDARDS
12043084ScaelThe
12143084Scael.Nm rm
12250625Scaelcommand is expected to be
12350625Scael.St -p1003.2
12450625Scaelcompatible.
125