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

📄 ch01_22.htm

📁 the unix power tools
💻 HTM
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 1] 1.22 How UNIX Keeps Track of Files: Inodes </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:31:26Z"><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="ch01_01.htm"TITLE="1. Introduction"><LINKREL="prev"HREF="ch01_21.htm"TITLE="1.21 Making Pathnames "><LINKREL="next"HREF="ch01_23.htm"TITLE="1.23 File Access Permissions "></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="ch01_21.htm"TITLE="1.21 Making Pathnames "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 1.21 Making Pathnames "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><B><FONTFACE="ARIEL,HELVETICA,HELV,SANSERIF"SIZE="-1">Chapter 1<BR>Introduction</FONT></B></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch01_23.htm"TITLE="1.23 File Access Permissions "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 1.23 File Access Permissions "BORDER="0"></A></TD></TR></TABLE>&nbsp;<HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="SECT1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-1020">1.22 How UNIX Keeps Track of Files: Inodes </A></H2><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-2055"></A><ACLASS="indexterm"NAME="AUTOID-2057"></A>The ability to mumble about <EMCLASS="emphasis">inodes</EM> is the key to social success at aUNIX gurus' cocktail party. This may not seem attractive to you, butsooner or later you will need to know what an inode is.</P><PCLASS="para">Seriously, inodes are an important part of the UNIX filesystem.You don't need to worry about them most of the time, but it doeshelp to know what they are.</P><PCLASS="para">An inode is a data structure on the diskthat describes a file. It holds most of the important informationabout the file, including the on-disk address of the file's datablocks (the part of the file that you care about).Each inode has its own identifying number, called an <EMCLASS="emphasis">i-number</EM>.<ACLASS="indexterm"NAME="AUTOID-2064"></A>You really don'tcare about where a file is physically located on a disk.You usually don't care about the i-number&nbsp;- unless you're trying to<SPANCLASS="link">find the links (<ACLASS="linkend"HREF="ch18_03.htm"TITLE="Files with Two or More Names">18.3</A>, <ACLASS="linkend"HREF="ch17_22.htm"TITLE="Finding the Links to a File ">17.22</A>)</SPAN>to a file.But you docare about the following information, all of which is stored in afile's inode:</P><ULCLASS="itemizedlist"><LICLASS="listitem"><PCLASS="para">The file's ownership: the user and the<SPANCLASS="link">group (<ACLASS="linkend"HREF="ch22_13.htm"TITLE="Groups and Group Ownership ">22.13</A>)</SPAN>that own the file</P></LI><LICLASS="listitem"><PCLASS="para">The file's<SPANCLASS="link">access mode (<ACLASS="linkend"HREF="ch01_23.htm"TITLE="File Access Permissions ">1.23</A>, <ACLASS="linkend"HREF="ch22_02.htm"TITLE="Tutorial on File and Directory Permissions ">22.2</A>)</SPAN>:whether or not various users and groups areallowed to read, write, or execute the file</P></LI><LICLASS="listitem"><PCLASS="para">The file's<SPANCLASS="link">timestamp (<ACLASS="linkend"HREF="ch21_05.htm"TITLE="What Good Is a File's Last Access Time? ">21.5</A>, <ACLASS="linkend"HREF="ch21_06.htm"TITLE="A File's Inode Change (not  &#34;Creation&quot;!) Time">21.6</A>)</SPAN>:when the file itself was last modified, whenthe file was last accessed, and when the inode was last modified</P></LI><LICLASS="listitem"><PCLASS="para">The file's type: whether the file is a regular file, a special file, orsome other kind of abstraction<SPANCLASS="link">masquerading (<ACLASS="linkend"HREF="ch01_29.htm"TITLE="When Is a File Not a File? ">1.29</A>)</SPAN>as a file</P></LI></UL><PCLASS="para">Each filesystem has a set number of inodes that are created when thefilesystem is first created (usually when the disk is firstinitialized). This number is therefore the maximum number of filesthat the filesystem can hold. It cannot be changed withoutreinitializing the filesystem, which destroys all the data that thefilesystem holds. It is possible, though rare,for a filesystem to run out of inodes, just like it ispossible to run out of storage space&nbsp;- this can happen on filesystemswith many, many small files.</P><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-2082"></A><ACLASS="indexterm"NAME="AUTOID-2085"></A>The<SPANCLASS="link"><EMCLASS="emphasis">ls -l</EM> (<ACLASS="linkend"HREF="ch22_02.htm"TITLE="Tutorial on File and Directory Permissions ">22.2</A>)</SPAN>command shows much of this information.The<SPANCLASS="link"><EMCLASS="emphasis">ls -i</EM> option (<ACLASS="linkend"HREF="ch18_04.htm"TITLE="More About Links ">18.4</A>)</SPAN>shows a file's i-number.The<ACLASS="indexterm"NAME="AUTOID-2092"></A><SPANCLASS="link"><EMCLASS="emphasis">stat</EM> (<ACLASS="linkend"HREF="ch21_13.htm"TITLE="Read an Inode with stat ">21.13</A>)</SPAN>command lists almost everything in an inode.</P><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="ch01_21.htm"TITLE="1.21 Making Pathnames "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 1.21 Making Pathnames "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="ch01_23.htm"TITLE="1.23 File Access Permissions "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 1.23 File Access Permissions "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">1.21 Making Pathnames </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">1.23 File Access Permissions </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 + -