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

📄 545-546.html

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

<HEAD>

<TITLE>Special Edition Using Linux, Fourth Edition:Using the emacs Editor</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=0789717468//-->

<!--TITLE=Special Edition Using Linux, Fourth Edition//-->

<!--AUTHOR=Jack Tackett//-->

<!--AUTHOR=Jr.//-->

<!--AUTHOR=Steve Burnett//-->

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

<!--IMPRINT=Que//-->

<!--CHAPTER=28//-->

<!--PAGES=545-546//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="543-545.html">Previous</A></TD>

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

<TD><A HREF="546-548.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<P><FONT SIZE="+1"><B>Suspending <I>emacs</I>

</B></FONT></P>

<P>You can suspend <TT>emacs</TT> &#151;in fact, you can suspend almost any Linux application&#151;by pressing &lt;Ctrl-z&gt;. This keystroke combination places the current application into the background and provides you with another shell prompt. The command to reactivate <TT>emacs</TT> depends on which shell you&#146;re executing. You can type the command <TT><I>fg</I></TT>, which means to bring the background task to the foreground. If the shell you&#146;re using doesn&#146;t understand this command, type <TT><B>exit</B></TT>, which reactivates your <TT>emacs</TT> session with all your files and buffers still intact.</P>

<P><FONT SIZE="+1"><B>Switching Between <I>emacs</I> and Other Virtual Terminals

</B></FONT></P>

<P>Linux provides the user with six virtual terminals&#151;hence, you have six different sessions. While in <TT>emacs</TT> you can press &lt;Ctrl-Alt-F<TT>x</TT> &gt;, where F<TT>x </TT> is one of the keyboard function keys F1 through F6, to activate another terminal. If you haven&#146;t already logged in to a session on that terminal, then you must do so, just like when you&#146;re first booting Linux. You then have a completely active Linux session. To switch back to <TT>emacs</TT>, simply press &lt;Ctrl-Alt-F<TT>x</TT> &gt; again. If you forget which session is running <TT>emacs</TT>, you can cycle through each of the virtual terminals by pressing &lt;Ctrl-Alt&gt; with each function key one by one.</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>See</B> &#147;Managing Users,&#148; <B>p. 107</B><HR></FONT>

</BLOCKQUOTE>

<P>You can also use the <TT>ps</TT> command to display all active processes, as shown in Listing 28.1. The output of the <TT>ps -guax</TT> command indicates which terminal each process is now executing.</P>

<P><B>Listing 28.1</B> Output from the <TT>ps</TT> Command</P>

<!-- CODE //-->

<PRE>

USER  PID %CPU %MEM SIZE  RSS TTY STAT START   TIME COMMAND

root    1  0.5  3.1   44  208  ?  S    20:48   0:00 init

root    6  0.0  1.8   24  124  ?  S    20:48   0:00 bdflush (daemon)

root    7  0.0  1.9   24  128  ?  S    20:48   0:00 update (bdflush)

root   23  0.0  2.9   56  200  ?  S    20:48   0:00 /usr/sbin/crond -l10

root   36  0.6  3.5   65  240  ?  S    20:48   0:00 /usr/sbin/syslogd

root   38  0.1  2.9   36  200  ?  S    20:48   0:00 /usr/sbin/klogd

root   40  0.3  3.2   68  216  ?  S    20:48   0:00 /usr/sbin/inetd

root   42  0.1  3.0   64  204  ?  S    20:48   0:00 /usr/sbin/lpd

root   47  0.1  6.0  259  404  ?  S    20:48   0:00 sendmail:accepting c

root   51  0.1  2.0   32  140  ?  S    20:48   0:00 selection -t ms

root   52  1.5  7.2  376  484 v01 S    20:48   0:01 -bash

root   53  0.3  3.4   88  232 v02 S    20:48   0:00 /sbin/getty tty2 3840

root   54  0.3  3.4   88  232 v03 S    20:48   0:00 /sbin/getty tty3 3840

root   55  0.2  3.4   88  232 v04 S    20:48   0:00 /sbin/getty tty4 3840

root   56  0.3  3.4   88  232 v05 S    20:48   0:00 /sbin/getty tty5 3840

root   57  0.3  3.4   88  232 v06 S    20:48   0:00 /sbin/getty tty6 3840

root   67  0.0  3.5   80  240 v01 R    20:49   0:00 ps -guax

</PRE>

<!-- END CODE //-->

<P>You can then use that TTY value, in the range of <TT>v01</TT> to <TT>v06</TT>, to pick the correct virtual terminal. For example, if the <TT>ps</TT> command indicates that <TT>emacs</TT> is now operating on <TT>tty v01</TT> and <TT>tty v02</TT>, pressing &lt;Alt-F1&gt; or &lt;Alt-F2&gt; brings you back to the appropriate <TT>emacs</TT> session.</P>

<P><FONT SIZE="+1"><B>Accessing Linux Commands from Within <I>emacs</I>

</B></FONT></P>

<P>Sometimes all you need to do is a quick check to see whether a file exists or to perform some other quick Linux command; you don&#146;t need a full shell session to perform the action. In that case, you can execute shell commands from within <TT>emacs</TT>. To execute a shell within <TT>emacs</TT>, press &lt;Ctrl-u&gt;&lt;Esc&gt;&lt;!&gt;. You&#146;re prompted to enter a shell command; enter the command and press &lt;Return&gt;. <TT>emacs</TT> passes the command to the Linux shell, which executes the command.</P>

<P>If you don&#146;t press &lt;Ctrl-u&gt;, <TT>emacs</TT> places the output into a buffer/window called <TT>*Shell Command Output*</TT>. You learn more about windows later in this chapter, but basically windows allow you to see multiple buffers at once. <TT>emacs</TT> provides various commands to move around between windows and to delete windows (without deleting their corresponding buffers). To delete the output window, press &lt;Ctrl-x&gt;&lt;1&gt;.</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="543-545.html">Previous</A></TD>

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

<TD><A HREF="546-548.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 + -