Strict Standards: Declaration of action_plugin_loglog::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/public/screen/lib/plugins/loglog/action.php on line 15

Strict Standards: Declaration of action_plugin_captcha::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/public/screen/lib/plugins/captcha/action.php on line 0
GNU screen [faq]

Differences

This shows you the differences between two versions of the page.

faq [2010/01/21 23:44]
asciiphil Links to titles changed to man:titles
faq [2015/03/02 15:52] (current)
asciiphil Add a question mark.
Line 1: Line 1:
====== FAQ ====== ====== FAQ ======
 +  
==== How do I get screen to put things into my terminal's scrollback? ==== ==== How do I get screen to put things into my terminal's scrollback? ====
 + 
 +First off, it's recommended that you use ''screen'''s scrollback buffer instead.  Since you can have multiple windows in a ''screen'' session, if you switch between those windows, your terminal scrollback will mix lines from all of those windows, but ''screen'' keeps separate scrollback buffers for each one.  Just use ''[[commands:copy|C-a ESC]]''  or ''[[commands:copy|C-a []]'' to enter [[commands:copy]] mode.  (See also the [[interface#xterm-style_scrolling|interface examples]] for a description of how to make ''xterm'''s keystrokes work on ''screen'' instead.)  But if you do want scrollback in your terminal window (usually ''xterm''), read on.
-First off, it's recommended that you use screen's scrollback buffer instead.  Since you can have multiple windows in a screen session, if you switch between those windows, your terminal scrollback will mix lines from all of those windows, but screen keeps separate scrollback buffers for each one.  Just use ''C-a ESC'' or ''C-a ['' to enter [[copy]] mode.  But if you do want scrollback in your terminal window (usually xterm), read on.+Some background: One capability that a terminal may have is an "alternate screen".  ''xterm'' has it, and you may have seen its effects--a program will request the alternate screen, the terminal switches there, and when the program exits the terminal goes back to the normal screen, leaving all the text there intact.  It is recommended that all full-screen apps use this, so as to minimize their impact on any purely command-line stuff. It makes sense, for instance, for ''vi'' to use the alternate screen.  The drawback to the alternate screen is that only the main screen accumulates scrollback.
-Some background: One capability that a terminal may have is an "alternate screen".  xterm has it, and you may have seen its effects--a program will request the alternate screen, the terminal switches there, and when the program exits the terminal goes back to the normal screen, leaving all the text there intact.  It is recommended that all full-screen apps use this, so as to minimize their impact on any purely command-line stuff.  It makes sense, for instance, for vi to use the alternate screen.  The drawback to the alternate screen is that only the main screen accumulates scrollback. +As you might have guessed, ''screen'' uses the alternate screen, if it's available.  There's no real way to turn off use of the alternate screen, but you can make ''screen'' think that the terminal doesn't have an alternate screen with the ''[[commands:termcapinfo]]'' command:
- +
-As you might have guessed, screen uses the alternate screen, if it's available.  There's no real way to turn off use of the alternate screen, but you can make screen think that the terminal doesn't have an alternate screen with the termcapinfo command:+
<code> <code>
Line 15: Line 16:
==== How can screen use xterm's title bar? ==== ==== How can screen use xterm's title bar? ====
-in your .screenrc:+In your .screenrc:
<code> <code>
termcapinfo xterm*|rxvt*|kterm*|Eterm* 'hs:ts=\E]0;:fs=\007:ds=\E]0;\007' termcapinfo xterm*|rxvt*|kterm*|Eterm* 'hs:ts=\E]0;:fs=\007:ds=\E]0;\007'
Line 22: Line 23:
</code> </code>
-Some terminals have a "hardstatus" line--a region that is separate from the main block of text but that programs can use to show status messages.  The termcap entry ''hs'' indicates that a terminal has a hardstatus line.  ''ts'' gives the escape sequence for entering the hardstatus line, ''fs'' gives the escape sequence for leaving it, and ''ds'' gives the escape sequence for clearing it.  The above hack treats xterm's titlebar as a hardstatus line and defines a default status string.  (The status string understands the normal [[man:string escapes]], but uses '^E' in place of '%'.)  The ''hardstatus off'' line tells screen not to print status messages (such as "Bell in window 0" and so on) via the hardstatus line, useful since it isn't a //real// hardstatus line.+Some terminals have a "hardstatus" line--a region that is separate from the main block of text but that programs can use to show status messages.  The termcap entry ''hs'' indicates that a terminal has a hardstatus line.  ''ts'' gives the escape sequence for entering the hardstatus line, ''fs'' gives the escape sequence for leaving it, and ''ds'' gives the escape sequence for clearing it.  The above hack treats ''xterm'''s titlebar as a hardstatus line and defines a default status string.  (The status string understands the normal [[man:string escapes]], but uses '^E' in place of '%'.)  The ''[[commands:hardstatus]] off'' line tells screen not to print status messages (such as "Bell in window 0" and so on) via the hardstatus line, useful since it isn't a //real// hardstatus line
 + 
 +As mentioned in [[man:the virtual terminal]], programs in ''screen'' can use the escape sequence ''ESC_//<message>//ESC\'' to change the hardstatus message for a particular window.  The sequence ''ESC]0;//<message>//^G'' also works, so with the above hardstatus hack in place, programs' changes to the ''xterm'' titlebar will be passed through ''screen''.
-As mentioned in [[man:the virtual terminal]], programs in screen can use the escape sequence ''ESC_//<message>//ESC\'' to change the hardstatus message for a particular window.  The sequence ''ESC]0;//<message>//^G'' also works, so with the above hardstatus hack in place, programs' changes to the xterm titlebar will be passed through screen.+See the [[appearance#status_bar_and_xterm_title|status bar and xterm title]] example for more details.
==== How do I set my window titles automatically? ==== ==== How do I set my window titles automatically? ====
-See the page on [[man:titles]].+See the page on [[title examples]].
-==== How do I set and use session names ====+==== How do I set and use session names? ====
See the page on [[sessionnames]]. See the page on [[sessionnames]].
Line 38: Line 41:
(The implied question being, "How do I keep my split windows over a detach?") (The implied question being, "How do I keep my split windows over a detach?")
-The short is answer is that you can't.  The longer answer is that you can fake it.+The short is answer is that you can't.  The longer answer is that you can fake it. (Note: the next ''screen'' release, probably numbered 4.1.0, will be able to remember display layouts.)
-Splits are a property of your display.  The process managing your screen session doesn't really know about them; only the single process that's displaying the session does.  Thus, the screen session can't remember the splits because it doesn't know about them, and once you detach, the process that did know about them has exited.+Splits are a property of your display.  The process managing your ''screen'' session doesn't really know about them; only the single process that's displaying the session does.  Thus, the ''screen'' session can't remember the splits because it doesn't know about them, and once you detach, the process that did know about them has exited.
-The hack is to use nested screen sessions.  Start one session and give it some escape sequence that you won't use much (or just disable its escape character completely).  Bind your usual detach key sequence to this screen session.  Now, start or attach to your main screen session.  All of your work will be done in the inner session, and you can split your display.  When you detach, however, it will be the outer session that detaches, so your splits in the inner session will be preserved.+The hack is to use nested ''screen'' sessions.  Start one session and give it some escape sequence that you won't use much (or just disable its escape character completely).  Bind your usual detach key sequence to this ''screen'' session.  Now, start or attach to your main ''screen'' session.  All of your work will be done in the inner session, and you can split your display.  When you detach, however, it will be the outer session that detaches, so your splits in the inner session will be preserved.
Assuming you use the default escape character, C-a, your alternate screenrc should contain: Assuming you use the default escape character, C-a, your alternate screenrc should contain:
Line 53: Line 56:
==== How to send a command to a window in a running screen session from the commandline? ==== ==== How to send a command to a window in a running screen session from the commandline? ====
-(We assume that we have a screen session with the name test running with a window 0.)+(We assume that we have a ''screen'' session with the name "test" running with a window 0.)
<code> <code>
Line 69: Line 72:
</code> </code>
-The window will appear with the application (in this case, "top") running.  The following will open it, and switch back to your current window, in effect "launching" the command in the background:+The window will appear with the application (in this case, ''top'') running.  The following will open it, and switch back to your current window, in effect "launching" the command in the background:
<code> <code>
Line 103: Line 106:
==== How do I have screen windows appear in my terminal as tabs? ==== ==== How do I have screen windows appear in my terminal as tabs? ====
-You can patch gnome-terminal to become screen-aware, after which screen windows appear as tabs in the terminal, and you can still attach and detach from the screen.+You can patch gnome-terminal to become ''screen''-aware, after which ''screen'' windows appear as tabs in the terminal, and you can still attach and detach from the ''screen'' session.
Tutorial here: http://monia.wordpress.com/2006/08/31/integrating-gnome-terminal-and-screen/ Tutorial here: http://monia.wordpress.com/2006/08/31/integrating-gnome-terminal-and-screen/
 +(Note:This link wants you to sign in to view it. Is there a copy of this page anywhere that doesn't require that?)
==== I have a nested screen session - how do I send screen commands to the inner screen? ==== ==== I have a nested screen session - how do I send screen commands to the inner screen? ====
-When your outer/local screen appears to catch your escape character, you have two options to send the escape to the inner screen:+When your outer/local ''screen'' session appears to catch your escape character, you have two options to send the escape to the inner ''screen'' session:
-  - (The quick-and-dirty method) When needed, tell the "outer" screen session to send a <C-a> to the inner session, with "<C-a> a".  For example, if you want to send "<C-a> c" to the inner session, you would type "<C-a> a c" to the outer session. +  - (The quick-and-dirty method) When needed, tell the "outer" screen session to send a ''C-a'' to the inner session, with ''[[commands:meta|C-a a]]''.  For example, if you want to send ''[[commands:screen|C-a c]]'' to the inner session, you would type ''C-a a c'' to the outer session.  For deeper nesting, just add more (middle) ''a'' keystrokes for each nested level
-  - (The sticky method) Change the "escape" keystroke in one of the sessions, so they do not interfere.  For instance, to change the inner session's meta character to, say, <C-s> (instead of <C-a>), use "<C-a> a : escape ^ss<Enter>".  Thereafter, use <C-s> for the inner screen session, instead of <C-a>.+  - (The sticky method) Change the [[commands:escape]] keystroke in one of the sessions, so they do not interfere.  For instance, to change the inner session's [[commands:escape]] character to, say, ''C-s'' (instead of ''C-a''), use "''[[commands:colon|C-a a :]] [[commands:escape]] ^ss''".  Thereafter, use ''C-s'' for the inner ''screen'' session, instead of ''C-a''.
 +=== Oops, my process is running but not in ''screen'' ===
 +On Linux, we've heard that [[https://github.com/nelhage/reptyr|reptyr]] will let you pull a process into ''screen'' (i.e. grab its controlling terminal).  ''reptyr'' claims to be better than ''screenify''.
 
faq.1264117476.txt.gz · Last modified: 2010/01/21 23:44 by asciiphil
Recent changes RSS feed GNU General Public License Driven by DokuWiki