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

📄 252-254.html

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

<HEAD>

<TITLE>Linux Unleashed, Third Edition:tcsh3</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=13//-->

<!--PAGES=252-254//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="248-252.html">Previous</A></TD>

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

<TD><A HREF="254-257.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<H3><A NAME="Heading10"></A><FONT COLOR="#000077">Job Control</FONT></H3>

<P>Job control refers to the ability to control the execution behavior of a currently running process. Specifically, you can suspend a running process and cause it to resume running at a later time. <TT>tcsh</TT> keeps track of all the processes that it starts as a result of user input. You can suspend a running process or restart a suspended one at any time during the life of that process.</P>

<P>Pressing the <TT>Ctrl&#43;Z</TT> key sequence suspends a running process. The <TT>bg</TT> command restarts a suspended process in the background, and the <TT>fg</TT> command restarts a process in the foreground.</P>

<P>These commands are most often used when you want to run a command in the background but accidentally start it in the foreground. When a command is started in the foreground, it locks the shell from any further user interaction until the command completes execution. This is usually not a problem because most commands take only a few seconds to execute. If the command you&#146;re running is going to take a long time, you will probably want to start the command in the background so that you can continue to use <TT>tcsh</TT> to enter other commands.</P>

<P>For example, if you start a command that is going to take a long time in the foreground, such as</P>

<!-- CODE SNIP //-->

<PRE>

find / -named &#147;test&#148; &gt; find.out

</PRE>

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

<P>your shell will be tied up for several minutes. If you have done this and want to cause the <TT>find</TT> command to continue executing in the background, you can enter the following:</P>

<!-- CODE SNIP //-->

<PRE>

Ctrl-z

bg

</PRE>

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

<P>This suspends the <TT>find</TT> command and then restarts it in the background. The <TT>find</TT> command continues to execute, and you regain control of <TT>tcsh</TT>.</P>

<H3><A NAME="Heading11"></A><FONT COLOR="#000077">Key Bindings</FONT></H3>

<P>Like the <TT>pdksh</TT>, <TT>tcsh</TT> provides the ability to change and add key bindings. The <TT>tcsh</TT> implementation of key bindings is more powerful than the way key bindings are done in <TT>pdksh</TT>.</P>

<P>With <TT>tcsh</TT> you can bind to things other than the built-in editor commands. This means that you can bind a key to a UNIX command, for example. <TT>tcsh</TT> also enables you to bind <TT>vi</TT> editing commands, whereas <TT>pdksh</TT> only allows the binding of <TT>emacs</TT> editing commands.</P>

<P>Key bindings can be very useful, especially if you&#146;re using a favorite editor other than <TT>emacs</TT> or <TT>vi</TT>. The basic syntax for defining key bindings is</P>

<!-- CODE SNIP //-->

<PRE>

bindkey [<I>option</I>] &lt;<I>instring or keyname</I>&gt; &lt;<I>outstring or command</I>&gt;

</PRE>

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

<P>The options that <TT>bindkey</TT> supports are not discussed in this book. If you want to learn about the <TT>bindkey</TT> options, refer to the <TT>tcsh</TT> man page. The basic function of the <TT>bindkey</TT> command is to bind the key sequence contained in the first argument to the command contained in the second argument.</P>

<P>The following list gives some of the most useful editing commands that you can bind key sequences to, along with the default key binding for that command. You can list all the bindings that are defined in <TT>tcsh</TT> by typing the <TT>bindkey</TT> command without any arguments.</P>

<DL>

<DD><B>&#149;</B>&nbsp;&nbsp;<TT>beginning-of-line</TT> (<TT>^A</TT>): Moves the cursor to the beginning of the command line.

<DD><B>&#149;</B>&nbsp;&nbsp;<TT>backward-char</TT> (<TT>^B</TT>): Moves the cursor back one character.

<DD><B>&#149;</B>&nbsp;&nbsp;<TT>end-of-line</TT> (<TT>^E</TT>): Moves the cursor to the end of the command line.

<DD><B>&#149;</B>&nbsp;&nbsp;<TT>forward-char</TT> (<TT>^F</TT>): Moves the cursor forward one character.

<DD><B>&#149;</B>&nbsp;&nbsp;<TT>backward-delete-char</TT> (<TT>^H</TT>): Deletes the character to the left of the cursor.

<DD><B>&#149;</B>&nbsp;&nbsp;<TT>kill-line</TT> (<TT>^K</TT>): Deletes all of the characters to the right of the cursor.

<DD><B>&#149;</B>&nbsp;&nbsp;<TT>clear-screen</TT> (<TT>^L</TT>): Removes all of the text from the shell window.

<DD><B>&#149;</B>&nbsp;&nbsp;<TT>down-history</TT> (<TT>^N</TT>): Moves down one command in the history list.

<DD><B>&#149;</B>&nbsp;&nbsp;<TT>up-history</TT> (<TT>^P</TT>): Moves up one command in the history list.

<DD><B>&#149;</B>&nbsp;&nbsp;<TT>kill-whole-line</TT> (<TT>^U</TT>): Deletes all of the characters on the current line.

</DL>

<P>All of these commands are the same whether you&#146;re in <TT>emacs</TT> or <TT>vi</TT> insert mode. <TT>tcsh</TT> supports many more editing commands than are listed here. To see what these commands are, refer to the <TT>tcsh</TT> man page.</P>

<P>The following are examples of setting key bindings:</P>

<!-- CODE SNIP //-->

<PRE>

bindkey ^W kill-whole-line

bindkey ^S beginning-of-line

</PRE>

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

<H3><A NAME="Heading12"></A><FONT COLOR="#000077">Other Neat Stuff</FONT></H3>

<P><TT>tcsh</TT> supports several neat features that none of the other shells discussed in this book supports. This section lists a few of the most useful of these extended features.</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="248-252.html">Previous</A></TD>

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

<TD><A HREF="254-257.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 + -