rhl08.htm

来自「linux的初学电子书」· HTM 代码 · 共 2,355 行 · 第 1/5 页

HTM
2,355
字号
<HTML>

<HEAD>

<TITLE>Red Hat Linux Unleashed rhl08.htm </TITLE>

<LINK REL="ToC" HREF="index-1.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/index.htm">

<LINK REL="Index" HREF="htindex.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/htindex.htm">

<LINK REL="Next" HREF="rhl09.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl09.htm">

<LINK REL="Previous" HREF="rhl07.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl07.htm"></HEAD>

<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">

<A NAME="I0"></A>

<H2>Red Hat Linux Unleashed rhl08.htm</H2>

<P ALIGN=LEFT>

<A HREF="rhl07.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl07.htm" TARGET="_self"><IMG SRC="purprev.gif" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/purprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"></A>

<A HREF="index-1.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/index.htm" TARGET="_self"><IMG SRC="purtoc.gif" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/purtoc.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="TOC"></A>

<A HREF="rhl09.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl09.htm" TARGET="_self"><IMG SRC="purnext.gif" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/purnext.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Next Page"></A>


<HR ALIGN=CENTER>

<P>

<UL>

<UL>

<UL>

<LI>

<A HREF="#E68E52" >Files An Overview</A>

<UL>

<LI>

<A HREF="#E69E47" >Common Types of Files</A>

<LI>

<A HREF="#E69E48" >Filenames</A></UL>

<LI>

<A HREF="#E68E53" >Directories An Overview</A>

<UL>

<LI>

<A HREF="#E69E49" >Parent Directories and Subdirectories</A>

<LI>

<A HREF="#E69E50" >The Root Directory</A>

<LI>

<A HREF="#E69E51" >How Directories Are Named</A>

<LI>

<A HREF="#E69E52" >The Home Directory</A></UL>

<LI>

<A HREF="#E68E54" >Navigating the Linux File System</A>

<UL>

<LI>

<A HREF="#E69E53" >The pwd Command Where Am I?</A>

<LI>

<A HREF="#E69E54" >Absolute and Relative Filenames</A>

<LI>

<A HREF="#E69E55" >Going Places The cd Command</A>

<LI>

<A HREF="#E69E56" >There's No Place Like Home</A></UL>

<LI>

<A HREF="#E68E55" >Creating and Deleting Files</A>

<UL>

<LI>

<A HREF="#E69E57" >cat That Useful Feline</A>

<LI>

<A HREF="#E69E58" >Creating Directories</A>

<LI>

<A HREF="#E69E59" >Moving and Copying Files</A>

<LI>

<A HREF="#E69E60" >Moving and Copying with Wildcards</A>

<LI>

<A HREF="#E69E61" >Moving Directories</A></UL>

<LI>

<A HREF="#E68E56" >Removing Files and Directories</A>

<UL>

<LI>

<A HREF="#E69E62" >Removing Directories</A></UL>

<LI>

<A HREF="#E68E57" >File Permissions and Ownership</A>

<UL>

<LI>

<A HREF="#E69E63" >File and Directory Ownership</A>

<LI>

<A HREF="#E69E64" >File Permissions</A>

<LI>

<A HREF="#E69E65" >Changing File Permissions</A>

<LI>

<A HREF="#E69E66" >Changing Directory Permissions</A></UL>

<LI>

<A HREF="#E68E58" >Miscellaneous File Commands</A>

<UL>

<LI>

<A HREF="#E69E67" >Fear of Compression The Zipless File</A>

<LI>

<A HREF="#E69E68" >How to tar Without Feathering</A></UL>

<LI>

<A HREF="#E68E59" >Important Directories in the Linux File System</A>

<UL>

<LI>

<A HREF="#E69E69" >/</A>

<LI>

<A HREF="#E69E70" >/home</A>

<LI>

<A HREF="#E69E71" >/bin</A>

<LI>

<A HREF="#E69E72" >/usr</A>

<LI>

<A HREF="#E69E73" >/usr/bin</A>

<LI>

<A HREF="#E69E74" >/var/spool</A>

<LI>

<A HREF="#E69E75" >/dev</A>

<LI>

<A HREF="#E69E76" >/usr/sbin</A>

<LI>

<A HREF="#E69E77" >/sbin</A>

<LI>

<A HREF="#E69E78" >/etc</A></UL>

<LI>

<A HREF="#E68E60" >Summary</A></UL></UL></UL>

<HR ALIGN=CENTER>

<A NAME="E66E8"></A>

<H1 ALIGN=CENTER>

<CENTER>

<FONT SIZE=6 COLOR="#FF0000"><B>8</B></FONT></CENTER></H1>

<BR>

<A NAME="E67E8"></A>

<H2 ALIGN=CENTER>

<CENTER>

<FONT SIZE=6 COLOR="#FF0000"><B>The Linux File System</B></FONT></CENTER></H2>

<BR>

<P>In this chapter, you learn about:

<BR>

<UL>

<LI>Files: what they are, types of files, filenames

<BR>

<BR>

<LI>Directories: what they are, parent directories and subdirectories, directory names, your home directory

<BR>

<BR>

<LI>Absolute and relative file and directory names

<BR>

<BR>

<LI>Moving between directories using the cd command

<BR>

<BR>

<LI>Using the cat command to create a new file

<BR>

<BR>

<LI>Creating directories

<BR>

<BR>

<LI>Moving and copying files

<BR>

<BR>

<LI>Removing files and directories

<BR>

<BR>

<LI>File and directory ownership, using chown and chgrp to change ownership

<BR>

<BR>

<LI>File and directory permissions, using chmod to change permissions

<BR>

<BR>

<LI>Using the gunzip command to uncompress .gz files compressed by gzip

<BR>

<BR>

<LI>The tar command

<BR>

<BR>

<LI>The standard Linux directories and directory structure

<BR>

<BR>

</UL>

<P>To understand how Linux works, and to use the system beyond a superficial level, you must be familiar with the Linux notion of files and the file system into which they are organized.

<BR>

<BR>

<A NAME="E68E52"></A>

<H3 ALIGN=CENTER>

<CENTER>

<FONT SIZE=5 COLOR="#FF0000"><B>Files An Overview</B></FONT></CENTER></H3>

<BR>

<P>The most basic concept of a file, and one you may already be familiar with from other computer systems, defines a file as a distinct chunk of information that is found on your hard drive. Distinct means that there can be many different files, each with 
its own particular contents. To keep files from getting confused with each other, every file must have a unique identity. In Linux, you identify each file by its name and location. In each location or directory, there can be only one file by a particular 
name. So, for instance, if you create a file called novel, and you get a second great idea, you will either have to call it something different, such as novel2, or put it in a different place, to keep from overwriting the contents already in your original 
novel.

<BR>

<BR>

<A NAME="E69E47"></A>

<H4 ALIGN=CENTER>

<CENTER>

<FONT SIZE=4 COLOR="#FF0000"><B>Common Types of Files</B></FONT></CENTER></H4>

<BR>

<P>Files can contain various types of information. The following three types will become the most familiar to you:

<BR>

<UL>

<LI>User data: Information that you create and update. The very simplest user data is plain text or numbers. You learn to create these simple files later in this chapter. More complicated user data files might have to be interpreted by another program to 
make sense. For instance, a spreadsheet file looks like gibberish if you look at it directly. To work with a spreadsheet, you have to start up the spreadsheet program and read in the spreadsheet file.

<BR>

<BR>

<LI>System data: Information, often in plain text form, that is read and used by the Linux system&#151;to keep track of which users are allowed on the system, for instance. As a system administrator, you are responsible for changing system data files. For 
instance, when you create a new user, you modify the file /etc/passwd, which contains the user information. Ordinary users of the system are usually not concerned with system data files, except for their private startup files.

<BR>

<BR>

<LI>Executable files: These files contain instructions that your computer can perform. This set of instructions is often called a program. When you tell the computer to perform them, you're telling it to execute the instructions given to it. To human eyes, 
executable files contain meaningless gibberish&#151;obviously your computer doesn't think the way you do! Creating or modifying executable files takes special tools. You learn how to use these programming tools in Part V, &quot;Linux for Programmers.&quot;


<BR>

<BR>

</UL>

<BR>

<A NAME="E69E48"></A>

<H4 ALIGN=CENTER>

<CENTER>

<FONT SIZE=4 COLOR="#FF0000"><B>Filenames</B></FONT></CENTER></H4>

<BR>

<P>Linux allows filenames to be up to 256 characters long. These characters can be lower- and uppercase letters, numbers, and other characters, usually the dash (-), the underscore (_), and the dot (.).

<BR>

<P>They can't include reserved metacharacters such as the asterisk, question mark, backslash, and space, because these all have meaning to the shell. We met some metacharacters when we discussed wildcards in the previous chapter. Other metacharacters will 
be introduced in the Linux shell chapters.

<BR>

<BR>

<A NAME="E68E53"></A>

<H3 ALIGN=CENTER>

<CENTER>

<FONT SIZE=5 COLOR="#FF0000"><B>Directories An Overview</B></FONT></CENTER></H3>

<BR>

<P>Linux, like many other computer systems, organizes files in directories. You can think of directories as file folders and their contents as the files. However, there is one absolutely crucial difference between the Linux file system and an office filing 
system. In the office, file folders usually don't contain other file folders. In Linux, file folders can contain other file folders. In fact, there is no Linux &quot;filing cabinet&quot;&#151;just a huge file folder that holds some files and other folders. 
These folders contain files and possibly other folders in turn, and so on.

<BR>

<BR>

<A NAME="E69E49"></A>

<H4 ALIGN=CENTER>

<CENTER>

<FONT SIZE=4 COLOR="#FF0000"><B>Parent Directories and Subdirectories</B></FONT></CENTER></H4>

<BR>

<P>Imagine a scenario in which you have a directory, A, that contains another directory, B. Directory B is then a subdirectory of directory A, and directory A is the parent directory of directory B. You will see these terms often, both in this book and 
elsewhere.

<BR>

<BR>

<A NAME="E69E50"></A>

<H4 ALIGN=CENTER>

<CENTER>

<FONT SIZE=4 COLOR="#FF0000"><B>The Root Directory</B></FONT></CENTER></H4>

<BR>

<P>In Linux, the directory that holds all the other directories is called the root directory. This is the ultimate parent directory; every other directory is some level of subdirectory.

<BR>

<P>From the root directory, the whole structure of directory upon directory springs and grows like some electronic elm. This is called a tree structure because, from the single root directory, directories and subdirectories branch off like tree limbs.

<BR>

<BR>

<A NAME="E69E51"></A>

⌨️ 快捷键说明

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