📄 ch23_13.htm
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 23] 23.13 Deleting Files with the Null Name </TITLE><METANAME="DC.title"CONTENT="UNIX Power Tools"><METANAME="DC.creator"CONTENT="Jerry Peek, Tim O'Reilly & Mike Loukides"><METANAME="DC.publisher"CONTENT="O'Reilly & Associates, Inc."><METANAME="DC.date"CONTENT="1998-08-04T21:41:10Z"><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="ch23_01.htm"TITLE="23. Removing Files"><LINKREL="prev"HREF="ch23_12.htm"TITLE="23.12 Using Wildcards to Delete Files with Strange Names "><LINKREL="next"HREF="ch23_14.htm"TITLE="23.14 Handling a Filename Starting with a Dash (-) "></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="ch23_12.htm"TITLE="23.12 Using Wildcards to Delete Files with Strange Names "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 23.12 Using Wildcards to Delete Files with Strange Names "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><B><FONTFACE="ARIEL,HELVETICA,HELV,SANSERIF"SIZE="-1">Chapter 23<BR>Removing Files</FONT></B></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch23_14.htm"TITLE="23.14 Handling a Filename Starting with a Dash (-) "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 23.14 Handling a Filename Starting with a Dash (-) "BORDER="0"></A></TD></TR></TABLE> <HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="SECT1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-0052">23.13 Deleting Files with the Null Name </A></H2><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-25684"></A><ACLASS="indexterm"NAME="AUTOID-25687"></A><ACLASS="indexterm"NAME="AUTOID-25689"></A>I write this article with fear and trepidation; I've never done this,and <EMCLASS="emphasis">clri</EM> is strong medicine. However, it's something that needsto be said.</P><PCLASS="para">I've seen several reports about files with null names - they evidentlyarise through some bad interaction between PCs running<SPANCLASS="link">NFS (<ACLASS="linkend"HREF="ch01_33.htm"TITLE="UNIX Networking and Communications ">1.33</A>)</SPAN>and UNIXsystems.[I've heard several reports of files with slashes (<CODECLASS="literal">/</CODE>) in theirfilenames.They came via NFS from Macintoshes.The method below should help with them. <EMCLASS="emphasis">-JP</EM>]For lots of reasons, it's virtually impossible to delete anull-named file. The following technique has been recommended:</P><ULCLASS="itemizedlist"><LICLASS="listitem"><PCLASS="para">Use <EMCLASS="emphasis">ls -ailF</EM> to find out the<SPANCLASS="link">inode number (<ACLASS="linkend"HREF="ch01_22.htm"TITLE="How UNIX Keeps Track of Files: Inodes ">1.22</A>)</SPAN>of the directory withthe null filename.</P></LI><LICLASS="listitem"><PCLASS="para">Becomesuperuserand dismount the filesystem that contains the directory with the nullfilename.</P></LI><LICLASS="listitem"><PCLASS="para">Use the command <CODECLASS="literal">clri</CODE> <CODECLASS="replaceable"><I>filesystem inode</I></CODE> to "clear" the<EMCLASS="emphasis">directory's</EM> inode, where <CODECLASS="replaceable"><I>inode</I></CODE> is the inode number ofthe directory that contains the null filename and <CODECLASS="replaceable"><I>filesystem</I></CODE> isthe name of the filesystem that contains this directory.</P></LI><LICLASS="listitem"><PCLASS="para">Run <EMCLASS="emphasis">fsck</EM>, and let it repair the damage.</P></LI></UL><DIVCLASS="sect1info"><PCLASS="SECT1INFO">- <SPANCLASS="authorinitials">ML</SPAN></P></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="ch23_12.htm"TITLE="23.12 Using Wildcards to Delete Files with Strange Names "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 23.12 Using Wildcards to Delete Files with Strange Names "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_14.htm"TITLE="23.14 Handling a Filename Starting with a Dash (-) "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 23.14 Handling a Filename Starting with a Dash (-) "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">23.12 Using Wildcards to Delete Files with Strange Names </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.14 Handling a Filename Starting with a Dash (-) </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 & 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 + -