📄 fastrm.8
字号:
.\" $Revision $.TH FASTRM 1.SH NAMEfastrm \- quickly remove a set of files.SH SYNOPSIS.B fastrm[.B \-d][.B \-e][.BI \-u N][.BI \-s M][.BI \-c I].I base_directory.SH DESCRIPTION.I Fastrmreads a list of files, one per line, from its standard input and removes them.If a file is not an absolute pathname, it is taken relative to the directoryspecified on the command line.The.I base_directoryparameter must be a simple absolute pathname \(em that is, it must notcontain any ``/./'' or ``/../'' references..PP.I Fastrmis designed to be faster than the typical ``|\ xargs\ rm'' pipeline.For example,.I fastrmwill usually.IR chdir (2)into a directory before removing files from it.If the input is sorted, this means that most files to be removed willbe simple names..PP.I Fastrmassumes that its input is valid and that it is safe to just do an.IR unlink (2)call for each item to be removed.As a safety measure, if.I fastrmis run by root it will first.IR stat (2)the item to make sure that it is not a directory before unlinking it..PPIf the ``\-d'' flag is used then no files are removed.Instead a list of the files to be removed, in debug form, is printedon the standard output.Each line contains either the current directory of.I fastrmat the time it would do the unlink, and then the path name itwould pass to.IR unlink (2)as two fields separated by white space and a ``/'', orthe absolute path name (a single field) of files it would unlinkusing the absolute path name..PPIf the ``\-e'' flag is used,.I fastrmwill treat an empty input file (\fBstdin\fP) as an error.This is most useful when .I fastrmis last in a pipeline after a preceding.BR sort (1)as if the sort fails, there will usually be no output to becomeinput of.IR fastrm ..PPIf the ``\-u'' flag is used, then.I fastrmmakes further assumptions about its work environment; in particular, thatthere are no symbolic links in the target tree.This flag also suggests that it is probably faster to reference the path.I \&``../../../''.\" I'm not all that convinced of the utility of using italics for dots...rather than start from the root and come down.(Note that this probably isn't true on systems that have a namei cache,which usually holds everything except.IR \&``..'' ).The optional.I Nis an integer that specifies the maximum number of.I \&``..''segments to use \(em paths that would use more than this use theabsolute path name (from the root) instead.If the ``\-u'' flag is given without a value, ``\-u1'' is assumed..PPIf the ``\-s'' flag is used, then.I fastrmwill perform the unlinks from one directory \(em that is when a group offiles in one directory appear in the input consecutively \(em in theorder that the files appear in the directory from which they are to beremoved.The intent of this flag is that on systems that have a per-processdirectory cache, finding files in the directory should be faster.It can have smaller benefits on other systems.The optional.I Mis an integer that specifies the number of files that must be goingto be removed from one directory before the files will be ordered.If the ``\-s'' flag is given without a value, ``\-s5'' is assumed.When the directory reordering is in use.I fastrmwill avoid attempting to unlink files that it can't see in thedirectory, which can speed it appreciably when many of the filenames have already been removed..PP.PPThe ``\-c'' flag may be given to instruct.I fastrmwhen it should.IR chdir (2).If the number of files to be unlinked from a directory is at least.I Ithen.I fastrmwill.I chdirand unlink the files from in the directory.Otherwise it will build a path relative to its current directory.If ``\-c'' is given without the optional integer.I Ithen ``\-c1'' is assumed, which will cause.I fastrmto always use.IR chdir .If ``\-c'' is not used at all, then ``\-c3'' is assumed.Use ``\-c0'' to prevent.I fastrmfrom ever using.IR chdir (2)..PPThere are also ``\-a'' and ``\-r'' options, which do nothing at all, exceptallow you to say ``fastrm \-usa'' ``fastrm \-ussr'' or ``fastrm \-user''.These happen to often be convenient sets of options to use..PP.I Fastrmexits with a status of zero if there were no problems, or one if somethingwent wrong.Attempting to remove a file that does not exist is not considered a problem.If the program exits with a non-zero status, it is probably a good idea tofeed the list of files into an ``xargs\ rm'' pipeline..SH HISTORY.de R$This is revision \\$3, dated \\$4....R$ $Id: fastrm.8,v 1.2 1993/01/29 16:42:44 rsalz Exp $
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -