xref: /freebsd/bin/rm/rm.1 (revision fe83da2eecd4ad041bb1eb7702b2724e7611e9df)
14b88c807SRodney W. Grimes.\" Copyright (c) 1990, 1993, 1994
24b88c807SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
34b88c807SRodney W. Grimes.\"
44b88c807SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by
54b88c807SRodney W. Grimes.\" the Institute of Electrical and Electronics Engineers, Inc.
64b88c807SRodney W. Grimes.\"
74b88c807SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
84b88c807SRodney W. Grimes.\" modification, are permitted provided that the following conditions
94b88c807SRodney W. Grimes.\" are met:
104b88c807SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
114b88c807SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
124b88c807SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
134b88c807SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
144b88c807SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
154b88c807SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software
164b88c807SRodney W. Grimes.\"    must display the following acknowledgement:
174b88c807SRodney W. Grimes.\"	This product includes software developed by the University of
184b88c807SRodney W. Grimes.\"	California, Berkeley and its contributors.
194b88c807SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
204b88c807SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
214b88c807SRodney W. Grimes.\"    without specific prior written permission.
224b88c807SRodney W. Grimes.\"
234b88c807SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
244b88c807SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
254b88c807SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
264b88c807SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
274b88c807SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
284b88c807SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
294b88c807SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
304b88c807SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
314b88c807SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
324b88c807SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
334b88c807SRodney W. Grimes.\" SUCH DAMAGE.
344b88c807SRodney W. Grimes.\"
351f64b5c9SSteve Price.\"	@(#)rm.1	8.5 (Berkeley) 12/5/94
36fe83da2eSMike Pritchard.\"	$Id: rm.1,v 1.7 1997/02/22 14:05:26 peter Exp $
374b88c807SRodney W. Grimes.\"
381f64b5c9SSteve Price.Dd December 5, 1994
394b88c807SRodney W. Grimes.Dt RM 1
404b88c807SRodney W. Grimes.Os
414b88c807SRodney W. Grimes.Sh NAME
424b88c807SRodney W. Grimes.Nm rm
434b88c807SRodney W. Grimes.Nd remove directory entries
444b88c807SRodney W. Grimes.Sh SYNOPSIS
454b88c807SRodney W. Grimes.Nm rm
464b88c807SRodney W. Grimes.Op Fl f | Fl i
471f64b5c9SSteve Price.Op Fl dPRrW
484b88c807SRodney W. Grimes.Ar file ...
494b88c807SRodney W. Grimes.Sh DESCRIPTION
504b88c807SRodney W. GrimesThe
514b88c807SRodney W. Grimes.Nm rm
524b88c807SRodney W. Grimesutility attempts to remove the non-directory type files specified on the
534b88c807SRodney W. Grimescommand line.
544b88c807SRodney W. GrimesIf the permissions of the file do not permit writing, and the standard
554b88c807SRodney W. Grimesinput device is a terminal, the user is prompted (on the standard error
564b88c807SRodney W. Grimesoutput) for confirmation.
574b88c807SRodney W. Grimes.Pp
584b88c807SRodney W. GrimesThe options are as follows:
594b88c807SRodney W. Grimes.Bl -tag -width flag
604b88c807SRodney W. Grimes.It Fl d
614b88c807SRodney W. GrimesAttempt to remove directories as well as other types of files.
624b88c807SRodney W. Grimes.It Fl f
634b88c807SRodney W. GrimesAttempt to remove the files without prompting for confirmation,
644b88c807SRodney W. Grimesregardless of the file's permissions.
654b88c807SRodney W. GrimesIf the file does not exist, do not display a diagnostic message or modify
664b88c807SRodney W. Grimesthe exit status to reflect an error.
674b88c807SRodney W. GrimesThe
684b88c807SRodney W. Grimes.Fl f
694b88c807SRodney W. Grimesoption overrides any previous
704b88c807SRodney W. Grimes.Fl i
714b88c807SRodney W. Grimesoptions.
724b88c807SRodney W. Grimes.It Fl i
734b88c807SRodney W. GrimesRequest confirmation before attempting to remove each file, regardless of
744b88c807SRodney W. Grimesthe file's permissions, or whether or not the standard input device is a
754b88c807SRodney W. Grimesterminal.
764b88c807SRodney W. GrimesThe
774b88c807SRodney W. Grimes.Fl i
784b88c807SRodney W. Grimesoption overrides any previous
794b88c807SRodney W. Grimes.Fl f
804b88c807SRodney W. Grimesoptions.
814b88c807SRodney W. Grimes.It Fl P
824b88c807SRodney W. GrimesOverwrite regular files before deleting them.
834b88c807SRodney W. GrimesFiles are overwritten three times, first with the byte pattern 0xff,
844b88c807SRodney W. Grimesthen 0x00, and then 0xff again, before they are deleted.
854b88c807SRodney W. Grimes.It Fl R
864b88c807SRodney W. GrimesAttempt to remove the file hierarchy rooted in each file argument.
874b88c807SRodney W. GrimesThe
884b88c807SRodney W. Grimes.Fl R
894b88c807SRodney W. Grimesoption implies the
904b88c807SRodney W. Grimes.Fl d
914b88c807SRodney W. Grimesoption.
924b88c807SRodney W. GrimesIf the
934b88c807SRodney W. Grimes.Fl i
944b88c807SRodney W. Grimesoption is specified, the user is prompted for confirmation before
954b88c807SRodney W. Grimeseach directory's contents are processed (as well as before the attempt
964b88c807SRodney W. Grimesis made to remove the directory).
974b88c807SRodney W. GrimesIf the user does not respond affirmatively, the file hierarchy rooted in
984b88c807SRodney W. Grimesthat directory is skipped.
994b88c807SRodney W. Grimes.Pp
1004b88c807SRodney W. Grimes.It Fl r
1014b88c807SRodney W. GrimesEquivalent to
1024b88c807SRodney W. Grimes.Fl R .
1031f64b5c9SSteve Price.It Fl W
1041f64b5c9SSteve PriceAttempts to undelete the named files.
1051f64b5c9SSteve PriceCurrently, this option can only be used to recover
1061f64b5c9SSteve Pricefiles covered by whiteouts. (UNIMPLEMENTED)
1074b88c807SRodney W. Grimes.El
1084b88c807SRodney W. Grimes.Pp
1094b88c807SRodney W. GrimesThe
1104b88c807SRodney W. Grimes.Nm rm
1114b88c807SRodney W. Grimesutility removes symbolic links, not the files referenced by the links.
1124b88c807SRodney W. Grimes.Pp
1134b88c807SRodney W. GrimesIt is an error to attempt to remove the files ``.'' and ``..''.
1144b88c807SRodney W. Grimes.Pp
1154b88c807SRodney W. GrimesThe
1164b88c807SRodney W. Grimes.Nm rm
1174b88c807SRodney W. Grimesutility exits 0 if all of the named files or file hierarchies were removed,
1184b88c807SRodney W. Grimesor if the
1194b88c807SRodney W. Grimes.Fl f
1204b88c807SRodney W. Grimesoption was specified and all of the existing files or file hierarchies were
1214b88c807SRodney W. Grimesremoved.
1224b88c807SRodney W. GrimesIf an error occurs,
1234b88c807SRodney W. Grimes.Nm rm
1244b88c807SRodney W. Grimesexits with a value >0.
125b0205affSWolfram Schneider.Sh NOTE
126fe83da2eSMike PritchardThe
127fe83da2eSMike Pritchard.Nm
128fe83da2eSMike Pritchardcommand uses
129b0205affSWolfram Schneider.Xr getopt 3
130fe83da2eSMike Pritchardto parse its arguments, which allows it to accept
131fe83da2eSMike Pritchardthe
132b0205affSWolfram Schneider.Sq Li --
133fe83da2eSMike Pritchardoption which will cause it to stop processing flag options at that
134fe83da2eSMike Pritchardpoint.  This will allow the removal of file names that begin
135fe83da2eSMike Pritchardwith a dash
136fe83da2eSMike Pritchard.Pq Sq - .
137fe83da2eSMike PritchardFor example:
138fe83da2eSMike Pritchard.Dl rm -- -filename
1394b88c807SRodney W. Grimes.Sh SEE ALSO
1404b88c807SRodney W. Grimes.Xr rmdir 1 ,
1411f64b5c9SSteve Price.Xr undelete 2 ,
1424b88c807SRodney W. Grimes.Xr unlink 2 ,
1434b88c807SRodney W. Grimes.Xr fts 3 ,
144b0205affSWolfram Schneider.Xr getopt 3 ,
1454b88c807SRodney W. Grimes.Xr symlink 7
1464b88c807SRodney W. Grimes.Sh BUGS
1474b88c807SRodney W. GrimesThe
1484b88c807SRodney W. Grimes.Fl P
1494b88c807SRodney W. Grimesoption assumes that the underlying file system is a fixed-block file
1504b88c807SRodney W. Grimessystem.
1514b88c807SRodney W. GrimesUFS is a fixed-block file system, LFS is not.
1524b88c807SRodney W. GrimesIn addition, only regular files are overwritten, other types of files
1534b88c807SRodney W. Grimesare not.
1541f64b5c9SSteve Price.Pp
1551f64b5c9SSteve PriceNo support exists for the
1561f64b5c9SSteve Price.Xr undelete 2
1571f64b5c9SSteve Pricecall in the kernel, so the
1581f64b5c9SSteve Price.Fl W
1591f64b5c9SSteve Priceoption is not yet implemented.
1604b88c807SRodney W. Grimes.Sh COMPATIBILITY
1614b88c807SRodney W. GrimesThe
1624b88c807SRodney W. Grimes.Nm rm
1634b88c807SRodney W. Grimesutility differs from historical implementations in that the
1644b88c807SRodney W. Grimes.Fl f
1654b88c807SRodney W. Grimesoption only masks attempts to remove non-existent files instead of
1664b88c807SRodney W. Grimesmasking a large variety of errors.
1674b88c807SRodney W. Grimes.Pp
1684b88c807SRodney W. GrimesAlso, historical
1694b88c807SRodney W. Grimes.Bx
1704b88c807SRodney W. Grimesimplementations prompted on the standard output,
1714b88c807SRodney W. Grimesnot the standard error output.
1724b88c807SRodney W. Grimes.Sh STANDARDS
1734b88c807SRodney W. GrimesThe
1744b88c807SRodney W. Grimes.Nm rm
1754b88c807SRodney W. Grimescommand is expected to be
1764b88c807SRodney W. Grimes.St -p1003.2
1774b88c807SRodney W. Grimescompatible.
178b8923d4cSWolfram Schneider.Sh HISTORY
179b8923d4cSWolfram SchneiderA
180b8923d4cSWolfram Schneider.Nm
181b8923d4cSWolfram Schneidercommand appeared in
182b8923d4cSWolfram Schneider.At v1 .
183