File: 5.html

package info (click to toggle)
lg-issue41 1-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,724 kB
  • ctags: 156
  • sloc: makefile: 36; ansic: 8; sh: 4
file content (173 lines) | stat: -rw-r--r-- 7,252 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<!--startcut ======================================================= -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<META NAME="generator" CONTENT="lgazmail v1.1J.e">
<TITLE>The Answer Guy 41: Flexible Logging of Terminal Output to Files: Use 'screen'</TITLE>
</HEAD><BODY BGCOLOR="#FFFFFF" TEXT="#000000"
	LINK="#3366FF" VLINK="#A000A0">
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<H4>"The Linux Gazette...<I>making Linux just a little more fun!</I>"</H4>
<P> <hr> <P>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<center>
<H1><A NAME="answer">
	<img src="../../gx/dennis/qbubble.gif" alt="(?)" 
		border="0" align="middle">
	<font color="#B03060">The Answer Guy</font>
	<img src="../../gx/dennis/bbubble.gif" alt="(!)" 
		border="0" align="middle">
</A></H1> 
<BR>
<H4>By James T. Dennis,
	<a href="mailto:answerguy@ssc.com">answerguy@ssc.com</a><BR>
	LinuxCare,
	<A HREF="http://www.linuxcare.com/">http://www.linuxcare.com/</A> 
</H4>
</center>

<p><hr><p>
<!--  endcut ======================================================= -->
<!-- begin 5 -->
<H3 align="left"><img src="../../gx/dennis/qbubble.gif" 
	height="50" width="60" alt="(?) " border="0"
	>Flexible Logging of Terminal Output to Files: Use 'screen'</H3>


<p><strong>From Phillip Nguyen  on Thu, 01 Apr 1999  
</strong></p>
<!-- ::
Flexible Logging of Terminal Output to Files: Use 'screen'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG><IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
	HEIGHT="28" WIDTH="50" BORDER="0"
	>
Hi,
</STRONG></P>
<P><STRONG>
The Linux xterm does not give me the option to log the screen to
file in the pop up windows (Ctrl-leftbutton).
</STRONG></P>
<P><STRONG>
I know I can use script to log the screen, but that means I have
to get out of telnet run the script program then run telnet again.
My problem is I don't want to log the whole session, I only wants
part of the session here and there to do debugging.  Is there a
way that I can make Linux xterm to give me the "Log to file"
option in the pop-up window.
</STRONG></P>
<P><STRONG>
Thanks.
Phillip.
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
	HEIGHT="28" WIDTH="50" BORDER="0"
	>
Use '<tt>screen</tt>' --- you'd start that before you start
your '<tt>telnet</tt>' session (assuming that you want to
log to a file on your local system).
</BLOCKQUOTE>
<BLOCKQUOTE>
'screen' has a number of nice features for users of
consoles, telnet, dial-up terminals, and xterms.
When you start it, 'screen' reserves one key ([Ctrl]+[A]
by default) as a way to access it's many options.  Of
course you can set that meta key to some other value.
I'll refer to it in the following text as [Meta]
</BLOCKQUOTE>
<BLOCKQUOTE>
You use [Meta],[H] (upper case) to start logging.  This will
create a file, in the directory from which you started
'screen' named screenlog.0 (the first time you start one).
You can toggle this on and off (and it will close and reopen
the file as appropriate).  Actually the "Hardcopy" file will
be named screenlog.N where N is the number of the window
from which you started the logging.  'screen' allows you to
start multiple interactive "windows" or "screens" through
the same terminal connection (xterm, on the same virtual
console, whatever).  You can do this using [Meta],[c] to
"create" additional screen sessions.
</BLOCKQUOTE>
<BLOCKQUOTE>
You can switch among screens (using [Meta],[Meta] to switch
to the most recently used screen, [Meta],[Space] to cycle to
the "next" screen, and [Meta] followed by a digit, to switch
directly to one of the screens).  You can "grab" a screen
shot using [Meta],[h] (lowercase "H").
</BLOCKQUOTE>
<BLOCKQUOTE>
You can detach 'screen' from your terminal (all
jobs started through it will continue running as though
they were still connected to your terminal).  You can
then re-attach to any terminal you like.  So you can
detach from your xterm, logout, dial or telnet in from
some other place, and re-attach to your 'screen' session
where you can continue working right where you left off.
(I'm running xemacs under 'screen' right now).  'screen'
can also be configured to "autodetach" --- which is
handy if you are logged in through a flaky modem or
network connection.  You just log back in and re-attach
with the command '<tt>screen -r</tt>'
</BLOCKQUOTE>
<BLOCKQUOTE>
You can also cut and paste using 'screen' keyboard
bindings.  So you use [Meta] "[" (left bracket) or
[Meta],[Esc] (escape), to get into "cut/backscroll"
mode.  Then you use cursor movements (mostly like
'<tt>vi</tt>' bindings by default) to move your cursor to a starting
location (on the screen or somewhere in 'screen's backscroll
buffer).  The you hit the space bar to start marking ---
move you cursor to some later location and hit the space
bar again to "cut/copy" the intervening text.  You can
then use [Meta]"]" (right bracket) to "paste" that
text (which will act exactly as though you'd retyped
it).  This cut and paste feature can be very handy when
you can manage to log into a system where you don't
have any file transfer capabilities.  You can at
least cut and paste bits of configuration text to
get things working on the remote system.  It's also
handy when you have something in one text mode app that
you want to put in an editor.  (I use it all the time
to copy link information from Lynx, my web browser, into
xemacs (my mail reader is an emacs mode, <tt>mh-e</tt>).
</BLOCKQUOTE>
<BLOCKQUOTE>
So, '<TT>screen</TT>' is the power tool you need for this job.
</BLOCKQUOTE>
<!-- sig -->

<!-- end 5 -->
<!--startcut ======================================================= -->
<P> <hr> <P>
<H5 align="center"><a href="http://www.linuxgazette.com/ssc.copying.html"
	>Copyright &copy;</a> 1999, James T. Dennis 
<BR>Published in <I>The Linux Gazette</I> Issue 41 May 1999</H5>
<P> <hr> <P>
<!-- begin tagnav ::::::::::::::::::::::::::::::::::::::::::::::::::-->
<TABLE WIDTH="96%"><TR VALIGN="center" ALIGN="center">
<TD ROWSPAN="1" COLSPAN="1" WIDTH="30%"><A HREF="../lg_answer41.html"
	><IMG SRC="../../gx/dennis/answernew.gif"
              ALT="[ Answer Guy Index ]"></A></td>
  <TD WIDTH="10%"><A HREF="1.html">1</A></TD>
  <TD WIDTH="10%"><A HREF="2.html">2</A></TD>
  <TD WIDTH="10%"><A HREF="3.html">3</A></TD>
  <TD WIDTH="10%"><A HREF="4.html">4</A></TD>
  <TD WIDTH="10%"><A HREF="5.html">5</A></TD>
  <TD WIDTH="10%"><A HREF="6.html">6</A></TD>
</TR></TABLE>
<!-- end tagnav ::::::::::::::::::::::::::::::::::::::::::::::::::::-->
<P> <hr> <P>
<!-- begin lgnav ::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<A HREF="../lg_toc41.html"
	><IMG SRC="../../gx/indexnew.gif" ALT="[ Table Of Contents ]"></A>
<A HREF="../../index.html"
	><IMG SRC="../../gx/homenew.gif" ALT="[ Front Page ]"></A>
<A HREF="../lg_bytes41.html"
	><IMG SRC="../../gx/back2.gif" ALT="[ Previous Section ]"></A>
<A HREF="../lg_tips41.html"
	><IMG SRC="../../gx/fwd.gif" ALT="[ Next Section ]"></A>
<!-- end lgnav ::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
</BODY></HTML>
<!--endcut ========================================================= -->