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

📄 0329-0331.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:


<HTML>

<HEAD>

<TITLE>Developer.com - Online Reference Library - 0672311739:RED HAT LINUX 2ND EDITION:Essential System Administration</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=0672311739 //-->

<!-- TITLE=RED HAT LINUX 2ND EDITION //-->

<!-- AUTHOR=DAVID PITTS ET AL //-->

<!-- PUBLISHER=MACMILLAN //-->

<!-- IMPRINT=SAMS PUBLISHING //-->

<!-- PUBLICATION DATE=1998 //-->

<!-- CHAPTER=15 //-->

<!-- PAGES=0319-0340 //-->

<!-- UNASSIGNED1 //-->

<!-- UNASSIGNED2 //-->









<P><CENTER>

<a href="0326-0328.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0332-0335.html">Next</A>

</CENTER></P>



<A NAME="PAGENUM-329"><P>Page 329</P></A>













<P>be read from cover to cover, like a good C. S. Lewis novel, but is intended to be a

resource guide&#151;a place to go to find specific answers to specific questions. The following sections

discuss the places you can turn to get help.

</P>









<H4><A NAME="ch15_ 18">





Man Pages

</A></H4>









<P>The man pages are like the Marines. They are your first lines of defense. Man pages

contain the online version of the Red Hat UNIX reference manuals. They provide definitions and

explanations of commands. In addition, they provide optional parameters for commands to

perform specific functions. After all of the explanations are examples, and finally, other

commands that are similar or relate to the command you looked up.

</P>









<P>The format of the man pages is as follows:

</P>









<UL>

<LI>     NAME



<LI>     SYNOPSIS



<LI>     DESCRIPTION



<LI>     COMMAND-LINE OPTIONS



<LI>     SEE ALSO



<LI>     BUGS

</UL>









<P>Over time, especially in Linux, people have customized the man pages to include other

optional fields. Some of these fields are AUTHOR, SORT KEYS, UPDATING, and

NOTES. The additions have been added to enhance the pages. For example, the AUTHOR section

many times includes an e-mail address of the author. This is good if the command is not working

as you expected it to. (Remember, none of Linux was taken from AT&amp;T's UNIX, so small

differences do exist, even in the &quot;standard&quot; commands.)

</P>









<P>Probably the one thing to point out to new man page users is the syntax used for showing

the SYNOPSIS of the command. There are several standards that are followed in writing

commands that are used in the man pages. Here's the SYNOPSIS for the

ps command:

</P>





<!-- CODE SNIP //-->

<PRE>

SYNOPSIS

       ps  [-]  [lujsvmaxScewhrnu]  [txx]  [O[+|-]k1[[+|-]k2...]] [pids]

</PRE>

<!-- END CODE SNIP //-->











<P>Anything in square brackets ([]) is optional. Note that the only thing not optional in this

command is the command itself. Therefore, you can issue the

ps command without any options, and you will receive a snapshot of the current processes.

</P>









<P>The [-] means that the - is an optional argument. Many commercial versions of UNIX

require a dash to indicate that what follows are arguments. This is not true for the Red Hat

Linux version of the ps command. The next set of characters (between the next set of square

brackets) indicates that any of these parameters can be added to the

ps command. For example, a common set of parameters to add to the

ps command is -la, which will display a long listing of

all (including hidden) files.

</P>



<A NAME="PAGENUM-330"><P>Page 330</P></A>













<P>The man pages are not a singular file or directory of Linux manuals. Instead, the man pages

are a set of directories, each containing a section of the man pages. These directories contain

the raw data for the man pages. In Red Hat Linux, there are eight sections of man pages. In

addition, each section has corresponding catn subdirectories that store processed versions of

the man pages. When a man page is accessed, the program that formats the man pages saves a

copy of the formatted man page in the catn

(/etc/catn) directories. This saves time in the

future because the next time a user requests a man page for a specific subject, if that subject had

been accessed before, then the formatting does not have to be repeated, but can be displayed

from the previously formatted page. The following shows what information is found within

each section:

</P>



<TABLE WIDTH="360">

<TR><TD>

<B>Section</B>

</TD><TD>

<B>Content</B>

</TD></TR>

<TR><TD>

1

</TD><TD>

User commands

</TD></TR>

<TR><TD>

2

</TD><TD>

System calls

</TD></TR>

<TR><TD>

3

</TD><TD>

Functions and library routines

</TD></TR>

<TR><TD>

4

</TD><TD>

Special files, device drivers, and hardware

</TD></TR>

<TR><TD>

5

</TD><TD>

Configuration files and file formats

</TD></TR>

<TR><TD>

6

</TD><TD>

Games and demos

</TD></TR>

<TR><TD>

7

</TD><TD>

Miscellaneous: character sets, filesystem types, datatype

definitions, and so on

</TD></TR>

<TR><TD>

8

</TD><TD>

System administration commands and maintenance commands

</TD></TR>

</TABLE>













<P>The man command searches the sections in a predefined order: 1, 6, 8, 2, 3, 4, 5, and 7. It

checks for commands first, followed by system calls and library functions, and then the other sections.

</P>









<P>There is a special way of accessing the man pages so that all pages listing a certain piece of

data are displayed. This is the keyword search for man pages

(man -k). In order to use this searching capability, the command

catman -w must be issued first. This command (which takes a

little while) indexes the man pages so that the keyword search will work.

</P>









<P>One of the benefits of man pages is that you can add your own local man pages. A friend

of mine did not know how to do this, so he wrote a Perl program called

man.pl that performed a similar function. It was a shame that he didn't have this book to tell him it could be

done! Adding man pages is a wonderful way of documenting tools that you write for use at your

site. Two directories are left blank for that purpose. They are the

mann directory and the cat directory

(/usr/man/mann and /usr/man/cat).

</P>









<P>The simplest way of making a man page is to place some text in a file describing the

command or topic. However, it is fairly easy to make a more elaborate page that looks like a normal

man page. Man pages are designed for the nroff text formatter, and have text and

nroff directives intermingled.

</P>



<A NAME="PAGENUM-331"><P>Page 331</P></A>













<P>The best way to figure out what the different directives do is to look at a man page and see

how it is laid out. To do this with Linux, you must first gunzip the file. Once gunzipped, the

file can be looked at with a text editor. All the different directives begin with a period (or

dot). Table 15.1 lists many of the nroff directives and an explanation of what

they do.

</P>









<P>Table 15.1. nroff directives.</P>



<TABLE WIDTH="360">

<TR><TD>

<B>Directive</B>

</TD><TD>

<B>Explanation</B>

</TD></TR>

<TR><TD>

.B

</TD><TD>

Uses bold type for the text (entire line is bolded).

</TD></TR>

<TR><TD>

.fi

</TD><TD>

Starts autofilling the text (adjusting the text on the lines).

</TD></TR>

<TR><TD>

.I

</TD><TD>

Uses italicized type for the text (entire line is italicized).

</TD></TR>

<TR><TD>

.IP

</TD><TD>

Starts a new indented paragraph.

</TD></TR>

<TR><TD>

.nf

</TD><TD>

Stops autofilling the text (adjusting the text on the lines).

</TD></TR>

<TR><TD>

.PP

</TD><TD>

Starts a new paragraph.

</TD></TR>

<TR><TD>

.R

</TD><TD>

Uses Roman type for text given as its arguments.

</TD></TR>

<TR><TD>

.SH

</TD><TD>

Section heading (names are uppercase by convention).

</TD></TR>

<TR><TD>

.TH

</TD><TD>

Title heading (arguments are command name and section).

</TD></TR>

<TR><TD>

.TP

</TD><TD>

Tagged paragraph (uses a hanging indent).

</TD></TR>

<TR><TD>

.TP n

</TD><TD>

The n specifies the amount to indent.

</TD></TR>

</TABLE>





<P>When testing the man page, you can simulate an actual man page call to the file with the

following command:

</P>





<!-- CODE SNIP //-->

<PRE>

$ nroff -man &lt;file&gt; | more

</PRE>

<!-- END CODE SNIP //-->











<P>The man pages are not the only place that a resourceful system administrator can turn for

answers. There is also the Internet. Within the Internet there are e-mail, Web pages

describing how to do things, and newsgroups.

</P>









<H4><A NAME="ch15_ 19">





E-mail

</A></H4>









<P>With e-mail, you can send questions to people that you know who are doing similar work.

For example, when I get stuck writing Perl scripts, I send a note off to Rich. He drops

everything and responds immediately to my questions (yeah, right!). The point is, there are those that

you associate with who can assist you with your problems or point you on your way to success.

If you don't know anyone who is working with Red Hat Linux, you can do two things.

First, find new friends&#151;obviously the ones you have are holding you back; and secondly, you can

e-mail newsgroups.

</P>



<P><CENTER>

<a href="0326-0328.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0332-0335.html">Next</A>

</CENTER></P>









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

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

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