diff options
Diffstat (limited to 'misc/slackbook/html/shell-vt.html')
-rw-r--r-- | misc/slackbook/html/shell-vt.html | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/misc/slackbook/html/shell-vt.html b/misc/slackbook/html/shell-vt.html new file mode 100644 index 00000000..2d28160c --- /dev/null +++ b/misc/slackbook/html/shell-vt.html @@ -0,0 +1,137 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org" /> +<title>Virtual Terminals</title> +<meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" /> +<link rel="HOME" title="Slackware Linux Essentials" href="index.html" /> +<link rel="UP" title="The Shell" href="shell.html" /> +<link rel="PREVIOUS" title="The Bourne Again Shell (bash)" href="shell-bash.html" /> +<link rel="NEXT" title="Filesystem Structure" href="filesystem-structure.html" /> +<link rel="STYLESHEET" type="text/css" href="docbook.css" /> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> +</head> +<body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084" +alink="#0000FF"> +<div class="NAVHEADER"> +<table summary="Header navigation table" width="100%" border="0" cellpadding="0" +cellspacing="0"> +<tr> +<th colspan="3" align="center">Slackware Linux Essentials</th> +</tr> + +<tr> +<td width="10%" align="left" valign="bottom"><a href="shell-bash.html" +accesskey="P">Prev</a></td> +<td width="80%" align="center" valign="bottom">Chapter 8 The Shell</td> +<td width="10%" align="right" valign="bottom"><a href="filesystem-structure.html" +accesskey="N">Next</a></td> +</tr> +</table> + +<hr align="LEFT" width="100%" /> +</div> + +<div class="SECT1"> +<h1 class="SECT1"><a id="SHELL-VT" name="SHELL-VT">8.4 Virtual Terminals</a></h1> + +<p>So you're in the middle of working on something and you decide you need to do +something else. You could just drop what you're doing and switch tasks, but this is a +multi-user system, right? And you can log in as many times simultaneously as you want, +right? So why should you have to do one thing at a time?</p> + +<p>You don't. We can't all have multiple keyboards, mice, and monitors for one machine; +chances are most of us don't want them. Clearly, hardware isn't the solution. That leaves +software, and Linux steps up on this one, providing “virtual terminals”, or +“VTs”.</p> + +<p>By pressing <kbd class="USERINPUT">Alt</kbd> and a function key, you can switch +between virtual terminals; each function key corresponds to one. Slackware has logins on +6 VTs by default. <b class="KEYCAP">Alt</b>+<b class="KEYCAP">F2</b> will take you to the +second one, <b class="KEYCAP">Alt</b>+<b class="KEYCAP">F3</b> to the third, etc.</p> + +<p>The rest of the function keys are reserved for X sessions. Each X session uses its own +VT, beginning with the seventh (<b class="KEYCAP">Alt</b>+<b class="KEYCAP">F7</b>) and +going up. When in X, the <b class="KEYCAP">Alt</b>+<b class="KEYCAP">Function key</b> +combination is replaced with <b class="KEYCAP">Ctrl</b>+<b class="KEYCAP">Alt</b>+<b +class="KEYCAP">Function</b>; so if you are in X and want to get back to a text login +(without exiting your X session), <b class="KEYCAP">Ctrl</b>+<b class="KEYCAP">Alt</b>+<b +class="KEYCAP">F3</b> will take you to the third. (<b class="KEYCAP">Alt</b>+<b +class="KEYCAP">F7</b> will take you back, assuming you're using the first X session.)</p> + +<div class="SECT2"> +<h2 class="SECT2"><a id="AEN3024" name="AEN3024">8.4.1 Screen</a></h2> + +<p>But what about situations where there are no virtual terminals? What then? +Fortunately, slackware includes a beautiful screen manager aptly named <tt +class="COMMAND">screen</tt>. <tt class="COMMAND">screen</tt> is a terminal emulator that +has virtual terminal like capabilities. Executing <tt class="COMMAND">screen</tt> flashes +a brief introduction, then dumps to a terminal. Unlike the standard virtual terminals, +<tt class="COMMAND">screen</tt> has its own commands. All <tt class="COMMAND">screen</tt> +commands are prefixed with a <b class="KEYCAP">Crtl</b>+<b class="KEYCAP">A</b> +keystroke. For example, <b class="KEYCAP">Ctrl</b>+<b class="KEYCAP">A</b>+<b +class="KEYCAP">C</b> will create a new terminal session. <b class="KEYCAP">Ctrl</b>+<b +class="KEYCAP">A</b>+<b class="KEYCAP">N</b> will switch to the next terminal. <b +class="KEYCAP">Ctrl</b>+<b class="KEYCAP">A</b>+<b class="KEYCAP">P</b> switches to the +previous terminal.</p> + +<p><tt class="COMMAND">screen</tt> also supports detaching and re-attaching to <tt +class="COMMAND">screen</tt> sessions which is particularly useful for remote sessions via +<tt class="COMMAND">ssh</tt> and <tt class="COMMAND">telnet</tt>, (more on those later). +<b class="KEYCAP">Ctrl</b>+<b class="KEYCAP">A</b>+<b class="KEYCAP">D</b> will detach +from the currently running screen. Executing <tt class="COMMAND">screen -r</tt> will list +all currently running screen sessions you may reattach to.</p> + +<table border="0" bgcolor="#E0E0E0" width="100%"> +<tr> +<td> +<pre class="SCREEN"> +<samp class="PROMPT">%</samp> <kbd class="USERINPUT">screen -r</kbd> +There are several suitable screens on: + 1212.pts-1.redtail (Detached) + 1195.pts-1.redtail (Detached) + 1225.pts-1.redtail (Detached) + 17146.pts-1.sanctuary (Dead ???) +Remove dead screens with 'screen -wipe'. +Type "screen [-d] -r [pid.]tty.host" to resume one of them. +</pre> +</td> +</tr> +</table> + +<p>Running <tt class="COMMAND">screen -r 1212</tt> would reattach to the first screen +listed. I mentioned earlier how useful this was for remote sessions. If I were to login +to a remote slackware server via <tt class="COMMAND">ssh</tt>, and my connection was +severed by some chance occurrence such as a local power failure, whatever I was doing at +that moment would instantly perish, which can be a horrible thing for your server. Using +<tt class="COMMAND">screen</tt> prevents this by detaching my session if my connection is +dropped. Once my connection is restored, I can reattach to my screen session and resume +right where I left off.</p> +</div> +</div> + +<div class="NAVFOOTER"> +<hr align="LEFT" width="100%" /> +<table summary="Footer navigation table" width="100%" border="0" cellpadding="0" +cellspacing="0"> +<tr> +<td width="33%" align="left" valign="top"><a href="shell-bash.html" +accesskey="P">Prev</a></td> +<td width="34%" align="center" valign="top"><a href="index.html" +accesskey="H">Home</a></td> +<td width="33%" align="right" valign="top"><a href="filesystem-structure.html" +accesskey="N">Next</a></td> +</tr> + +<tr> +<td width="33%" align="left" valign="top">The Bourne Again Shell (bash)</td> +<td width="34%" align="center" valign="top"><a href="shell.html" +accesskey="U">Up</a></td> +<td width="33%" align="right" valign="top">Filesystem Structure</td> +</tr> +</table> +</div> +</body> +</html> + |