xref: /csrg-svn/bin/rm/rm.1 (revision 68037)
166860Sbostic.\" 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*68037Spendry.\"	@(#)rm.1	8.5 (Berkeley) 12/05/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
2067581Spendry.Op Fl dPRrW
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.
5466860Sbostic.It Fl P
5566860SbosticOverwrite regular files before deleting them.
5666860SbosticFiles are overwritten three times, first with the byte pattern 0xff,
5766860Sbosticthen 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 .
7667581Spendry.It Fl W
7767836SmckusickAttempts to undelete the named files.
7867836SmckusickCurrently, this option can only be used to recover
7967836Smckusickfiles covered by whiteouts.
8050625Scael.El
8143084Scael.Pp
8243084ScaelThe
8343084Scael.Nm rm
8445769Sbosticutility removes symbolic links, not the files referenced by the links.
8545769Sbostic.Pp
8645769SbosticIt is an error to attempt to remove the files ``.'' and ``..''.
8745769Sbostic.Pp
8845769SbosticThe
8945769Sbostic.Nm rm
9047195Sbosticutility exits 0 if all of the named files or file hierarchies were removed,
9147195Sbosticor if the
9245769Sbostic.Fl f
9347195Sbosticoption was specified and all of the existing files or file hierarchies were
9447195Sbosticremoved.
9547195SbosticIf an error occurs,
9647195Sbostic.Nm rm
9747195Sbosticexits with a value >0.
9843084Scael.Sh SEE ALSO
9945769Sbostic.Xr rmdir 1 ,
100*68037Spendry.Xr undelete 2 ,
10145769Sbostic.Xr unlink 2 ,
10255730Sbostic.Xr fts 3 ,
10355730Sbostic.Xr symlink 7
10466860Sbostic.Sh BUGS
10566860SbosticThe
10666860Sbostic.Fl P
10766860Sbosticoption assumes that the underlying file system is a fixed-block file
10866860Sbosticsystem.
10966860SbosticUFS is a fixed-block file system, LFS is not.
11066860SbosticIn addition, only regular files are overwritten, other types of files
11166860Sbosticare not.
11247195Sbostic.Sh COMPATIBILITY
11347195SbosticThe
11447195Sbostic.Nm rm
11547195Sbosticutility differs from historical implementations in that the
11647195Sbostic.Fl f
11747195Sbosticoption only masks attempts to remove non-existent files instead of
11847195Sbosticmasking a large variety of errors.
11947195Sbostic.Pp
12050625ScaelAlso, historical
12150625Scael.Bx
12250625Scaelimplementations prompted on the standard output,
12347195Sbosticnot the standard error output.
12443084Scael.Sh STANDARDS
12543084ScaelThe
12643084Scael.Nm rm
12750625Scaelcommand is expected to be
12850625Scael.St -p1003.2
12950625Scaelcompatible.
130