xref: /freebsd/bin/rm/rm.1 (revision 4b88c807ea9c629dc5691abc7e3cac9ea0d776dd)
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.\"
354b88c807SRodney W. Grimes.\"	@(#)rm.1	8.2 (Berkeley) 4/18/94
364b88c807SRodney W. Grimes.\"
374b88c807SRodney W. Grimes.Dd April 18, 1994
384b88c807SRodney W. Grimes.Dt RM 1
394b88c807SRodney W. Grimes.Os
404b88c807SRodney W. Grimes.Sh NAME
414b88c807SRodney W. Grimes.Nm rm
424b88c807SRodney W. Grimes.Nd remove directory entries
434b88c807SRodney W. Grimes.Sh SYNOPSIS
444b88c807SRodney W. Grimes.Nm rm
454b88c807SRodney W. Grimes.Op Fl f | Fl i
464b88c807SRodney W. Grimes.Op Fl dPRr
474b88c807SRodney W. Grimes.Ar file ...
484b88c807SRodney W. Grimes.Sh DESCRIPTION
494b88c807SRodney W. GrimesThe
504b88c807SRodney W. Grimes.Nm rm
514b88c807SRodney W. Grimesutility attempts to remove the non-directory type files specified on the
524b88c807SRodney W. Grimescommand line.
534b88c807SRodney W. GrimesIf the permissions of the file do not permit writing, and the standard
544b88c807SRodney W. Grimesinput device is a terminal, the user is prompted (on the standard error
554b88c807SRodney W. Grimesoutput) for confirmation.
564b88c807SRodney W. Grimes.Pp
574b88c807SRodney W. GrimesThe options are as follows:
584b88c807SRodney W. Grimes.Bl -tag -width flag
594b88c807SRodney W. Grimes.It Fl d
604b88c807SRodney W. GrimesAttempt to remove directories as well as other types of files.
614b88c807SRodney W. Grimes.It Fl f
624b88c807SRodney W. GrimesAttempt to remove the files without prompting for confirmation,
634b88c807SRodney W. Grimesregardless of the file's permissions.
644b88c807SRodney W. GrimesIf the file does not exist, do not display a diagnostic message or modify
654b88c807SRodney W. Grimesthe exit status to reflect an error.
664b88c807SRodney W. GrimesThe
674b88c807SRodney W. Grimes.Fl f
684b88c807SRodney W. Grimesoption overrides any previous
694b88c807SRodney W. Grimes.Fl i
704b88c807SRodney W. Grimesoptions.
714b88c807SRodney W. Grimes.It Fl i
724b88c807SRodney W. GrimesRequest confirmation before attempting to remove each file, regardless of
734b88c807SRodney W. Grimesthe file's permissions, or whether or not the standard input device is a
744b88c807SRodney W. Grimesterminal.
754b88c807SRodney W. GrimesThe
764b88c807SRodney W. Grimes.Fl i
774b88c807SRodney W. Grimesoption overrides any previous
784b88c807SRodney W. Grimes.Fl f
794b88c807SRodney W. Grimesoptions.
804b88c807SRodney W. Grimes.It Fl P
814b88c807SRodney W. GrimesOverwrite regular files before deleting them.
824b88c807SRodney W. GrimesFiles are overwritten three times, first with the byte pattern 0xff,
834b88c807SRodney W. Grimesthen 0x00, and then 0xff again, before they are deleted.
844b88c807SRodney W. Grimes.It Fl R
854b88c807SRodney W. GrimesAttempt to remove the file hierarchy rooted in each file argument.
864b88c807SRodney W. GrimesThe
874b88c807SRodney W. Grimes.Fl R
884b88c807SRodney W. Grimesoption implies the
894b88c807SRodney W. Grimes.Fl d
904b88c807SRodney W. Grimesoption.
914b88c807SRodney W. GrimesIf the
924b88c807SRodney W. Grimes.Fl i
934b88c807SRodney W. Grimesoption is specified, the user is prompted for confirmation before
944b88c807SRodney W. Grimeseach directory's contents are processed (as well as before the attempt
954b88c807SRodney W. Grimesis made to remove the directory).
964b88c807SRodney W. GrimesIf the user does not respond affirmatively, the file hierarchy rooted in
974b88c807SRodney W. Grimesthat directory is skipped.
984b88c807SRodney W. Grimes.Pp
994b88c807SRodney W. Grimes.It Fl r
1004b88c807SRodney W. GrimesEquivalent to
1014b88c807SRodney W. Grimes.Fl R .
1024b88c807SRodney W. Grimes.El
1034b88c807SRodney W. Grimes.Pp
1044b88c807SRodney W. GrimesThe
1054b88c807SRodney W. Grimes.Nm rm
1064b88c807SRodney W. Grimesutility removes symbolic links, not the files referenced by the links.
1074b88c807SRodney W. Grimes.Pp
1084b88c807SRodney W. GrimesIt is an error to attempt to remove the files ``.'' and ``..''.
1094b88c807SRodney W. Grimes.Pp
1104b88c807SRodney W. GrimesThe
1114b88c807SRodney W. Grimes.Nm rm
1124b88c807SRodney W. Grimesutility exits 0 if all of the named files or file hierarchies were removed,
1134b88c807SRodney W. Grimesor if the
1144b88c807SRodney W. Grimes.Fl f
1154b88c807SRodney W. Grimesoption was specified and all of the existing files or file hierarchies were
1164b88c807SRodney W. Grimesremoved.
1174b88c807SRodney W. GrimesIf an error occurs,
1184b88c807SRodney W. Grimes.Nm rm
1194b88c807SRodney W. Grimesexits with a value >0.
1204b88c807SRodney W. Grimes.Sh SEE ALSO
1214b88c807SRodney W. Grimes.Xr rmdir 1 ,
1224b88c807SRodney W. Grimes.Xr unlink 2 ,
1234b88c807SRodney W. Grimes.Xr fts 3 ,
1244b88c807SRodney W. Grimes.Xr symlink 7
1254b88c807SRodney W. Grimes.Sh BUGS
1264b88c807SRodney W. GrimesThe
1274b88c807SRodney W. Grimes.Fl P
1284b88c807SRodney W. Grimesoption assumes that the underlying file system is a fixed-block file
1294b88c807SRodney W. Grimessystem.
1304b88c807SRodney W. GrimesUFS is a fixed-block file system, LFS is not.
1314b88c807SRodney W. GrimesIn addition, only regular files are overwritten, other types of files
1324b88c807SRodney W. Grimesare not.
1334b88c807SRodney W. Grimes.Sh COMPATIBILITY
1344b88c807SRodney W. GrimesThe
1354b88c807SRodney W. Grimes.Nm rm
1364b88c807SRodney W. Grimesutility differs from historical implementations in that the
1374b88c807SRodney W. Grimes.Fl f
1384b88c807SRodney W. Grimesoption only masks attempts to remove non-existent files instead of
1394b88c807SRodney W. Grimesmasking a large variety of errors.
1404b88c807SRodney W. Grimes.Pp
1414b88c807SRodney W. GrimesAlso, historical
1424b88c807SRodney W. Grimes.Bx
1434b88c807SRodney W. Grimesimplementations prompted on the standard output,
1444b88c807SRodney W. Grimesnot the standard error output.
1454b88c807SRodney W. Grimes.Sh STANDARDS
1464b88c807SRodney W. GrimesThe
1474b88c807SRodney W. Grimes.Nm rm
1484b88c807SRodney W. Grimescommand is expected to be
1494b88c807SRodney W. Grimes.St -p1003.2
1504b88c807SRodney W. Grimescompatible.
151