📄 230-234.html
字号:
<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=230-234//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="228-230.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="234-236.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H4 ALIGN="LEFT"><A NAME="Heading24"></A><FONT COLOR="#000077">Viewing Online-Manual Pages with Man</FONT></H4>
<P>One of the handiest feature of UNIX—and by extension, of Linux—is the existence of online-manual pages, which detail the workings of specific commands. These online-manual pages (commonly referred to as <I>man</I> pages) will list the purpose of a given command, any command-line options, and perhaps other information. (For example, <B>man</B> pages created by the FSF for use with GNU commands tend to be rather verbose, going into the entire purpose of the command and listing any known bugs.) While this sort of information isn’t as useful as a full online help system (for example, you can’t look up a <B>man</B> page for any topics at all; <B>man</B> pages are written for specific commands), it still can help you a great deal, especially if you know a certain command can come close to doing what you want, but you need to know the precise option that yields the desired behavior.</P>
<P>To view an online-manual page, combine the name of the command with the <B>man</B> command:</P>
<!-- CODE SNIP //-->
<PRE>
gilbert:/$ man man
</PRE>
<!-- END CODE SNIP //-->
<P>You’ll then see the information shown in Figure 4.1.
</P>
<P><A NAME="Fig1"></A><A HREF="javascript:displayWindow('images/04-01.jpg',484,394 )"><IMG SRC="images/04-01t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/04-01.jpg',484,394)"><FONT COLOR="#000077"><B>Figure 4.1</B></FONT></A> The <B>man</B> command in action.
</P>
<P>The <B>man</B> page for <B>man</B> is obviously a multipage document, as evidenced by the information at the bottom of the screen, because the bottom sentence isn’t complete. To move up and down through the entire <B>man</B> page by entire pages, use the <B>PageUp</B> and <B>PageDown</B> keys; to move up and down the <B>man</B> page line by line, use the keyboard cursor keys ([uarr] and [darr]). To quit the <B>man</B> command and get a command prompt, press the <B>q</B> key (short for <I>quit</I>).</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>NOTE: </B>There’s an X Window equivalent of <B>man</B>, called <B>xman</B>, shown in Figure 4.2. You should use this command when running XFree86.<HR></FONT>
</BLOCKQUOTE>
<P><A NAME="Fig2"></A><A HREF="javascript:displayWindow('images/04-02.jpg',502,406 )"><IMG SRC="images/04-02t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/04-02.jpg',502,406)"><FONT COLOR="#000077"><B>Figure 4.2</B></FONT></A> The <B>xman</B> command in action.
</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>NOTE: </B>The <B>bash</B> shell contains its own help mechanism, which will be covered later in this chapter.<HR></FONT>
</BLOCKQUOTE>
<H4 ALIGN="LEFT"><A NAME="Heading25"></A><FONT COLOR="#000077">Finding Files</FONT></H4>
<P>The <B>find</B> command included with Linux (actually the GNU <B>find</B> command) is very similar to the <B>find</B> command that ships with most other versions of UNIX—that is, the GNU version is maddeningly complex and nonintuitive to use. At its best, <B>find</B> will search your entire filesystem for a specific file. At its worse, <B>find</B> will return every file on the system, leaving you scratching your head about how to proceed with a useful search.</P>
<P>Still, you shouldn’t run into too many problems with <B>find</B> if you remember one thing: You need to make sure all the elements of the command line are properly organized. For example, you won’t find the following command line very useful:</P>
<!-- CODE SNIP //-->
<PRE>
gilbert:~$ find *
</PRE>
<!-- END CODE SNIP //-->
<P>as it returns all the files in your current directory. Similarly, the following command line will list <I>every</I> file (at a dizzying speed, no less) on your Linux system:</P>
<!-- CODE SNIP //-->
<PRE>
gilbert:/$ find *
</PRE>
<!-- END CODE SNIP //-->
<P>a move guaranteed to give you a headache. (Remember, Linux does exactly what you tell it to do.)
</P>
<P>Instead, you’ll need to slow down and figure out how to use the <B>find</B> command. Let’s say you want to find the directory location of a file named <B>test.bk</B>. First, you need to tell <B>find</B> how to search for a file. We know the name of the file, so we begin our command line by telling <B>find</B> to search by filename. We do so with the <I>-name</I> option:</P>
<!-- CODE SNIP //-->
<PRE>
gilbert:/$ find * -name
</PRE>
<!-- END CODE SNIP //-->
<P>This is a start. Now we need to tell <B>find</B> what to look for. We do this by adding the name of the file:</P>
<!-- CODE SNIP //-->
<PRE>
gilbert:~$ find * -name test.bk
</PRE>
<!-- END CODE SNIP //-->
<P>If you wanted, you could use a wildcard instead of listing the specific filename. With or without a wildcard, however, the command should work.
</P>
<P>If you’re working with a large filesystem, you may want to run the <B>find</B> command in the background. This is accomplished by adding an ampersand to the command line:</P>
<!-- CODE SNIP //-->
<PRE>
gilbert:~$ find * -name test.bk &
</PRE>
<!-- END CODE SNIP //-->
<P>Running this command in the background allows you to do work while the <B>find</B> command searches for the file. For more information on running commands in the background, check out the section “Background Commands and Multitasking” later in this chapter.</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>NOTE: </B>When looking at other Linux texts, you’ll be able to see who actually wrote the book using Linux and who wrote the book with a knowledge of UNIX and not much experience with Linux by the way the <B>find</B> command is explained. In most versions of UNIX, the <B>find</B> command requires that <I>-print</I> be added to the end of the command line and that the name of the search be in quotation marks. The GNU version of <B>find</B> requires neither.<HR></FONT>
</BLOCKQUOTE>
<P>There’s a lot more to the <B>find</B> command, as it encompasses an amazing amount of complexity that’s meant for large-scale systems more than for the needs of the average Linux user. If you’re interested in knowing more about the <B>find</B> command, use the following command line:</P>
<!-- CODE SNIP //-->
<PRE>
gilbert:~$ man find
</PRE>
<!-- END CODE SNIP //-->
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="228-230.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="234-236.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -