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

📄 136-138.html

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

<HEAD>

<TITLE>Linux Unleashed, Third Edition:Basic Linux Commands</TITLE>

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

 -->




<!--ISBN=0672313723//-->

<!--TITLE=Linux Unleashed, Third Edition//-->

<!--AUTHOR=Tim Parker//-->

<!--PUBLISHER=Macmillan Computer Publishing//-->

<!--IMPRINT=Sams//-->

<!--CHAPTER=7//-->

<!--PAGES=136-138//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="134-136.html">Previous</A></TD>

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

<TD><A HREF="138-141.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<H4 ALIGN="LEFT"><A NAME="Heading11"></A><FONT COLOR="#000077">The bash Shell help Facility</FONT></H4>

<P>When you type a command at the prompt, the shell program takes what you&#146;ve written, interprets it as necessary, and passes the result to the Linux operating system. Linux then performs the actions requested of it. Many Linux commands require Linux to find and start up a new program. However, the shell itself can perform a number of functions. These functions can be simple, often-used commands, so that the overhead of starting up separate programs is eliminated or they can be facilities that make the shell environment friendlier and more useful. One of these facilities is the <TT><B>help</B></TT> command, which provides information on the built-in functions of the <TT><B>bash</B></TT> shell.</P>

<P>Type <TT><B>help</B></TT> at the prompt. You will see at least some of the following:</P>

<!-- CODE //-->

<PRE>

GNU bash, version 1.14.15(1)

Shell commands that are defined internally. Type &#146;help&#146; to see this list.

Type &#146;help name&#146; to find out more about the function &#146;name&#146;.

Use &#146;info bash&#146; to find out more about the shell in  general.



A star (*) next to a name means that the command is disabled.

 %[DIGITS | WORD] [&]                    . [filename]

 :                                       [ arg&#133; ]

 alias [ name[=value] &#133; ]   bg      [job_spec]

 bind [-lvd] [-m keymap] [-f filena      break [n]

 builtin [shell-builtin [arg &#133;] ]   case WORD in [PATTERN [| PATTERN].

 cd [dir]                                command [-pVv] [command [arg &#133;]]

 continue [n]                            declare [-[frxi]] name[=value] &#133;

 dirs [-l]                               echo [-neE] [arg &#133;]

 enable [-n] [name &#133;]               eval [arg &#133;]

 exec [ [-] file [redirection &#133;]]   exit [n]

 export [-n] [-f] [name &#133;] or exp   fc [-e name] [-nlr] [first] [last

 fg [job_spec]                           for NAME [in WORDS &#133; ;] do COMMA

 function NAME &#123; COMMANDS ; &#125;  or NA getopts optstring name [arg]

 hash [-r] [name &#133;]                 help [pattern &#133;]

 history [n] [ [-awrn] [filename]]       if COMMANDS; then COMMANDS; [elif

 jobs [-lnp] [jobspec &#133;] | jobs -   kill [-s sigspec | -sigspec] [pid

 let arg [arg &#133;]                    local name[=value] &#133;

 logout                                  popd [&#43;n | -n]

 pushd [dir | &#43;n | -n]               pwd

 read [-r] [name &#133;]                 readonly [-n] [-f] [name &#133;] or r

 return [n]                              select NAME [in WORDS &#133; ;] do CO

 set [--abefhknotuvxldHCP] [-o opti      shift [n]

 source filename                         suspend [-f]

 test [expr]                             times

 trap [arg] [signal_spec]                type [-all] [-type | -path] [name

 typeset [-[frxi]] name[=value] &#133;   ulimit [-SHacdmstfpnuv [limit]]

 umask [-S] [mode]                       unalias [-a] [name &#133;]

 unset [-f] [-v] [name &#133;]           until COMMANDS; do COMMANDS; done

 variables - Some variable names an wait [n]

 while COMMANDS; do COMMANDS; done &#123; COMMANDS &#125;

</PRE>

<!-- END CODE //-->

<P>You will have to pipe the output of <TT><B>help</B></TT> to <TT><B>more</B></TT> (<TT><B>help | more</B></TT>) to keep the first part from scrolling off your screen.</P>

<H3><A NAME="Heading12"></A><FONT COLOR="#000077">Wildcards: * and ?</FONT></H3>

<P>In many a late-night card game, jokers are shuffled into the deck. The jokers are <I>wildcards</I> that can become any card of your choice. This is obviously very useful! Linux also has wildcards. They are more useful than jokers in a card game.</P>

<P>Linux has several wildcards. Wildcards are used as a convenient and powerful shortcut when specifying files (or directories) that a command is to operate on. We will briefly look at the two most popular wildcards: <TT><B>*</B></TT> and <TT><B>?</B></TT>. (There are quite a few more wildcards supported by Linux, but they are seldom used and would only complicate the issue at this point.)</P>

<P>The most commonly used wildcard is <TT><B>*</B></TT>, which stands in for any combination of one or more characters. For example, <TT><B>c*</B></TT> matches all filenames that begin with c. You can see this for yourself by typing <TT><B>ls /bin/c*</B></TT>. What happens if you type <TT><B>ls /bin/c*t</B></TT> at the command line? How about <TT><B>ls /bin/*t</B></TT> at the command line?</P>

<P>The <TT><B>?</B></TT> wildcard is more restrictive than <TT><B>*</B></TT>. It stands in only for any <I>one</I> character. You can see this by comparing <TT><B>ls/bin/d*</B></TT> with <TT><B>ls/bin/d?</B></TT>.</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>Note:&nbsp;&nbsp;</B><BR>Wildcards can only be used to match filenames and directory names. You can&#146;t, for example, type <TT><B>pass*</B></TT> at the Linux prompt and expect Linux to run the <TT><B>passwd</B></TT> program for you.<HR></FONT>

</BLOCKQUOTE>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>Warning:&nbsp;&nbsp;</B><BR>Be very careful when using wildcards with dangerous commands, such as the ones used to permanently delete files! A good check is to run <TT><B>ls</B></TT> with the wildcards you plan to use and examine the resulting list of files to see whether the wildcard combination did what you expected it to do. Also double-check that you typed everything correctly <I>before</I> pressing the Enter key!<HR></FONT>

</BLOCKQUOTE>

<P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="134-136.html">Previous</A></TD>

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

<TD><A HREF="138-141.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 + -