200-203.html

来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 134 行

HTML
134
字号
<HTML>

<HEAD>

<TITLE>Linux Configuration and Installation:Basic Linux Tools</TITLE>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!--ISBN=1558285660//-->

<!--TITLE=Linux Configuration and Installation//-->

<!--AUTHOR=Patrick Volkerding//-->

<!--AUTHOR=Kevin Reichard//-->

<!--AUTHOR=Eric Foster//-->

<!--PUBLISHER=IDG Books Worldwide, Inc.//-->

<!--IMPRINT=M & T Books//-->

<!--CHAPTER=4//-->

<!--PAGES=200-203//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="197-200.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="203-206.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<H3><A NAME="Heading4"></A><FONT COLOR="#000077">File Types</FONT></H3>

<P>Under Linux, a file can be one of several types:

</P>

<DL>

<DD><B>&#149;</B>&nbsp;&nbsp;Ordinary files

<DD><B>&#149;</B>&nbsp;&nbsp;Directories

<DD><B>&#149;</B>&nbsp;&nbsp;Links

<DD><B>&#149;</B>&nbsp;&nbsp;Special device files

</DL>

<P>We&#146;re not going to spend a lot of time discussing each of these file types; you should be able to see the difference between them in the short explanations here. If you want more information about UNIX file types, check out one of the UNIX texts listed in Appendix A.

</P>

<H4 ALIGN="LEFT"><A NAME="Heading5"></A><FONT COLOR="#000077">Ordinary Files</FONT></H4>

<P><I>Ordinary files</I> win the Linux prize for truth in advertising; they tend to be rather ordinary. Generally speaking, you&#146;ll spend most of your time working with ordinary files of some sort:</P>

<DL>

<DD><B>&#149;</B>&nbsp;&nbsp;<I>Text files</I> are made up of ASCII text. For example, when you create a file in <B>emacs</B>, you&#146;re creating a text file. In addition, if you create source-code files for use in programming, you&#146;re creating text files.

<DD><B>&#149;</B>&nbsp;&nbsp;<I>Data files</I> may contain special characters not contained in the ASCII set. For example, the <B>xv</B> graphics editor creates and edits files in various graphics formats. Because these files contain non-ASCII characters, they are data files. The same would go for files created by a database manager or a spreadsheet manager.

<DD><B>&#149;</B>&nbsp;&nbsp;<I>Command text files</I>, also known as <I>shell scripts</I>, contain ASCII characters but are marked differently from other Linux files.

<DD><B>&#149;</B>&nbsp;&nbsp;<I>Executable files</I> are binary program files that are created when source-code files are compiled.

</DL>

<H4 ALIGN="LEFT"><A NAME="Heading6"></A><FONT COLOR="#000077">Directories</FONT></H4>

<P><I>Directories</I> are, well, directories. Under Linux, a directory is also a file that contains information about the directory. (Talk about the ultimate in self-referential logic&#133;) You&#146;ll learn more about directories soon, but the important thing to know is that directories can have the same sort of limitations&#151;i.e., permissions&#151;as can files.</P>

<H4 ALIGN="LEFT"><A NAME="Heading7"></A><FONT COLOR="#000077">Links</FONT></H4>

<P>A <I>link</I> is a reference to another file within the filesystem. This allows a file to be in two (or more) places at the same time&#151;in its original file location and at the reference elsewhere in the filesystem. You&#146;ll learn more about links later in this chapter.</P>

<H4 ALIGN="LEFT"><A NAME="Heading8"></A><FONT COLOR="#000077">Special Device Files</FONT></H4>

<P>In a sense, you&#146;ve already covered this type of file in Chapter 2, when you learned how Linux refers to various portions of the PC architecture, such as <B>/dev/hda</B> for the hard drive. These references are called <I>device files</I>, and they are used by Linux to represent physical portions of the PC. Under Linux&#151;and under UNIX, for that matter&#151;everything is a file, whether it a collection of data, a device file representing a physical piece of hardware (such as a printer, disk drive, etc.), or the kernel of the operating system itself. Similarly, even if you&#146;ve installed Linux on a PC with multiple hard drives, you&#146;ll never see a difference in the way Linux treats the separate drives; there will be only one large filesystem.</P>

<H3><A NAME="Heading9"></A><FONT COLOR="#000077">How Linux Organizes Files and Directories</FONT></H3>

<P>Most important Linux commands deal with the management of files and directories. Therefore, it&#146;s important that we take a moment and explain exactly how Linux treats these files and directories.

</P>

<P>Like DOS, Windows, the Macintosh OS, and other versions of UNIX, Linux stores files in a hierarchical fashion; files are stored in directories, and directories (or subdirectories) are stored in other directories. The only directory that&#146;s not a subdirectory of another directory is the <I>root</I> directory. This directory doesn&#146;t have a name (like <B>bin</B>, as seen in Table 4.1). Instead, the root directory is indicated by a slash (<B>/</B>). This is the opposite of MS-DOS, which uses the backslash (<B>\</B>) to indicate the root directory. The directory above the current directory in the hierarchy is called the <I>parent</I> directory. The Linux installation process creates quite a few directories, including the main subdirectories of the root directory. It&#146;s handy to know what&#146;s contained in these directories; they&#146;ll be the first place to look for specific files. Table 4.1 lists the main directories found in the root directory.</P>

<CENTER>

<TABLE WIDTH="95%"><CAPTION><B>Table 4.1</B> The Main Subdirectories of the Root Directory

<TR>

<TH WIDTH="30%" ALIGN="LEFT">Directory

<TH WIDTH="70%" ALIGN="LEFT">Contents

<TR>

<TH COLSPAN="2"><HR>

<TR>

<TD><B>bin</B>

<TD>Binary files

<TR>

<TD><B>boot</B>

<TD>Information needed to boot the system

<TR>

<TD><B>cdrom</B>

<TD>CD-ROM drive, if Linux supports your CD-ROM drive

<TR>

<TD><B>dev</B>

<TD>Device drivers

<TR>

<TD><B>etc</B>

<TD>Miscellaneous files, mostly used in system administration

<TR>

<TD><B>home</B>

<TD>The home directory for users

<TR>

<TD><B>lib</B>

<TD>Programming libraries

<TR>

<TD><B>tmp</B>

<TD>Temporary storage of temporary files

<TR>

<TD><B>usr</B>

<TD>Commands

<TR>

<TD><B>var</B>

<TD>System definitions

<TR>

<TD COLSPAN="2"><HR>

</TABLE>

</CENTER>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>NOTE:&nbsp;&nbsp;</B>Case counts in Linux across the board, as you&#146;ll learn time and time again. (This is different from DOS, where case doesn&#146;t matter.) If you tell Linux to look for a directory named <B>BIN</B>, the system won&#146;t find this directory. However, if you tell Linux to look for <B>bin</B>, the system will find it.

<P>The same goes for Linux commands&#151;when we tell you to use the <B>cd</B> command, we mean <B>cd</B>, not <B>Cd</B>, <B>CD</B>, or <B>cD</B>. Again, this is different from DOS.<HR></FONT>

</BLOCKQUOTE>

</P>

<P>Depending on how you installed Linux, you may also have a directory called <B>dos</B>, <B>dosc</B>, or something similar, which contains the MS-DOS partition on your hard drive.</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="197-200.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="203-206.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>





</td>
</tr>
</table>

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

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