⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch23_01.htm

📁 the unix power tools
💻 HTM
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 23] Removing Files</TITLE><METANAME="DC.title"CONTENT="UNIX Power Tools"><METANAME="DC.creator"CONTENT="Jerry Peek, Tim O'Reilly &amp; Mike Loukides"><METANAME="DC.publisher"CONTENT="O'Reilly &amp; Associates, Inc."><METANAME="DC.date"CONTENT="1998-08-04T21:40:56Z"><METANAME="DC.type"CONTENT="Text.Monograph"><METANAME="DC.format"CONTENT="text/html"SCHEME="MIME"><METANAME="DC.source"CONTENT="1-56592-260-3"SCHEME="ISBN"><METANAME="DC.language"CONTENT="en-US"><METANAME="generator"CONTENT="Jade 1.1/O'Reilly DocBook 3.0 to HTML 4.0"><LINKREV="made"HREF="mailto:online-books@oreilly.com"TITLE="Online Books Comments"><LINKREL="up"HREF="part03.htm"TITLE="III. Working with the Filesystem "><LINKREL="prev"HREF="ch22_22.htm"TITLE="22.22 The su Command Isn't Just for the Superuser "><LINKREL="next"HREF="ch23_02.htm"TITLE="23.2 rm and Its Dangers "></HEAD><BODYBGCOLOR="#FFFFFF"TEXT="#000000"><DIVCLASS="htmlnav"><H1><IMGSRC="gifs/smbanner.gif"ALT="UNIX Power Tools"USEMAP="#srchmap"BORDER="0"></H1><MAPNAME="srchmap"><AREASHAPE="RECT"COORDS="0,0,466,58"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="467,0,514,18"HREF="jobjects/fsearch.htm"ALT="Search this book"></MAP><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch22_22.htm"TITLE="22.22 The su Command Isn't Just for the Superuser "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 22.22 The su Command Isn't Just for the Superuser "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><B><FONTFACE="ARIEL,HELVETICA,HELV,SANSERIF"SIZE="-1">Chapter 23</FONT></B></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch23_02.htm"TITLE="23.2 rm and Its Dangers "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 23.2 rm and Its Dangers "BORDER="0"></A></TD></TR></TABLE>&nbsp;<HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="CHAPTER"><H1CLASS="chapter"><ACLASS="title"NAME="UPT-CHP-23">23. Removing Files</A></H1><DIVCLASS="htmltoc"><P><B>Contents:</B><BR><ACLASS="sect1"HREF="#UPT-ART-4860"TITLE="23.1 The Cycle of Creation and Destruction ">The Cycle of Creation and Destruction </A><BR><ACLASS="sect1"HREF="ch23_02.htm"TITLE="23.2 rm and Its Dangers ">rm and Its Dangers </A><BR><ACLASS="sect1"HREF="ch23_03.htm"TITLE="23.3 Tricks for Making rm Safer ">Tricks for Making rm Safer </A><BR><ACLASS="sect1"HREF="ch23_04.htm"TITLE='23.4 Answer "Yes&quot; or "No&quot; Forever with yes'>Answer &quot;Yes&quot; or &quot;No&quot; Forever with yes</A><BR><ACLASS="sect1"HREF="ch23_05.htm"TITLE="23.5 Remove Some, Leave Some ">Remove Some, Leave Some </A><BR><ACLASS="sect1"HREF="ch23_06.htm"TITLE="23.6 A Faster Way to Remove Files Interactively ">A Faster Way to Remove Files Interactively </A><BR><ACLASS="sect1"HREF="ch23_07.htm"TITLE="23.7 Safer File Deletion in Some Directories ">Safer File Deletion in Some Directories </A><BR><ACLASS="sect1"HREF="ch23_08.htm"TITLE="23.8 Safe Delete: Pros and Cons ">Safe Delete: Pros and Cons </A><BR><ACLASS="sect1"HREF="ch23_09.htm"TITLE="23.9 delete: Protecting Files from Accidental Deletion ">delete: Protecting Files from Accidental Deletion </A><BR><ACLASS="sect1"HREF="ch23_10.htm"TITLE="23.10 Deletion with Prejudice: rm -f ">Deletion with Prejudice: rm -f </A><BR><ACLASS="sect1"HREF="ch23_11.htm"TITLE="23.11 Deleting Files with Odd Names ">Deleting Files with Odd Names </A><BR><ACLASS="sect1"HREF="ch23_12.htm"TITLE="23.12 Using Wildcards to Delete Files with Strange Names ">Using Wildcards to Delete Files with Strange Names </A><BR><ACLASS="sect1"HREF="ch23_13.htm"TITLE="23.13 Deleting Files with the Null Name ">Deleting Files with the Null Name </A><BR><ACLASS="sect1"HREF="ch23_14.htm"TITLE="23.14 Handling a Filename Starting with a Dash (-) ">Handling a Filename Starting with a Dash (-) </A><BR><ACLASS="sect1"HREF="ch23_15.htm"TITLE="23.15 Using unlink to Remove a File with a Strange Name ">Using unlink to Remove a File with a Strange Name </A><BR><ACLASS="sect1"HREF="ch23_16.htm"TITLE="23.16 Removing a Strange File by its I-number ">Removing a Strange File by its I-number </A><BR><ACLASS="sect1"HREF="ch23_17.htm"TITLE="23.17 Problems Deleting Directories ">Problems Deleting Directories </A><BR><ACLASS="sect1"HREF="ch23_18.htm"TITLE="23.18 How Making and Deleting Directories Works ">How Making and Deleting Directories Works </A><BR><ACLASS="sect1"HREF="ch23_19.htm"TITLE="23.19 Deleting (BSD) Manual Pages that Aren't Read ">Deleting (BSD) Manual Pages that Aren't Read </A><BR><ACLASS="sect1"HREF="ch23_20.htm"TITLE="23.20 Deleting Stale Files ">Deleting Stale Files </A><BR><ACLASS="sect1"HREF="ch23_21.htm"TITLE="23.21 Removing Every File but One ">Removing Every File but One </A><BR><ACLASS="sect1"HREF="ch23_22.htm"TITLE="23.22 Using find to Clear Out Unneeded Files ">Using find to Clear Out Unneeded Files </A></P><P></P></DIV><DIVCLASS="sect1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-4860">23.1 The Cycle of Creation and Destruction </A></H2><PCLASS="para">As a computer user, you spend lots of time creating files. Just asthe necessary counterpart of life is death, the other side of filecreation is deletion. If you never delete any files, you soon have acomputer's equivalent of a population explosion: your disks get full,and you have to either spend money (buy and install more disk drives)or figure out which files you don't really need.</P><PCLASS="para">In this chapter, we'll talk about ways to get rid of files: how to doit safely, how to get rid of files that don't want to die, and how tofind &quot;stale&quot; files, or unused files that have been around for a longtime. &quot;Safe&quot; deletion is a particularly interesting topic, becauseUNIX's <EMCLASS="emphasis">rm</EM> command is extreme: once you delete a file, it's gonepermanently. There are several solutions for working around thisproblem, letting you (possibly) reclaim files from the dead.</P><DIVCLASS="sect1info"><PCLASS="SECT1INFO">- <SPANCLASS="authorinitials">ML</SPAN></P></DIV></DIV></DIV><DIVCLASS="htmlnav"><P></P><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch22_22.htm"TITLE="22.22 The su Command Isn't Just for the Superuser "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 22.22 The su Command Isn't Just for the Superuser "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="book"HREF="index.htm"TITLE="UNIX Power Tools"><IMGSRC="gifs/txthome.gif"SRC="gifs/txthome.gif"ALT="UNIX Power Tools"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch23_02.htm"TITLE="23.2 rm and Its Dangers "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 23.2 rm and Its Dangers "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">22.22 The su Command Isn't Just for the Superuser </TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="index"HREF="index/idx_0.htm"TITLE="Book Index"><IMGSRC="gifs/index.gif"SRC="gifs/index.gif"ALT="Book Index"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172">23.2 rm and Its Dangers </TD></TR></TABLE><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><IMGSRC="gifs/smnavbar.gif"SRC="gifs/smnavbar.gif"USEMAP="#map"BORDER="0"ALT="The UNIX CD Bookshelf Navigation"><MAPNAME="map"><AREASHAPE="RECT"COORDS="0,0,73,21"HREF="../index.htm"ALT="The UNIX CD Bookshelf"><AREASHAPE="RECT"COORDS="74,0,163,21"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="164,0,257,21"HREF="../unixnut/index.htm"ALT="UNIX in a Nutshell"><AREASHAPE="RECT"COORDS="258,0,321,21"HREF="../vi/index.htm"ALT="Learning the vi Editor"><AREASHAPE="RECT"COORDS="322,0,378,21"HREF="../sedawk/index.htm"ALT="sed &amp; awk"><AREASHAPE="RECT"COORDS="379,0,438,21"HREF="../ksh/index.htm"ALT="Learning the Korn Shell"><AREASHAPE="RECT"COORDS="439,0,514,21"HREF="../lrnunix/index.htm"ALT="Learning the UNIX Operating System"></MAP></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -