This is Info file screen.info, produced by Makeinfo-1.55 from the input file screen.texinfo. This file documents the the `Screen' virtual terminal manager. Copyright (c) 1993 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Foundation.  File: screen.info, Node: Title Screenrc, Prev: Title Prompts, Up: Naming Windows Setting up shell Titles in your `.screenrc' ------------------------------------------- Here are some .screenrc examples: screen -t top 2 nice top Adding this line to your .screenrc would start a niced version of the `top' command in window 2 name `top' rather than `nice'. shelltitle '> |csh' screen 1 This file would start a shell using the given shelltitle. The title specified is an auto-title that would expect the prompt and the typed command to look something like the following: /usr/joe/src/dir> trn (it looks after the '> ' for the command name). The window status would show the name `trn' while the command was running, and revert to `csh' upon completion. bind R screen -t '% |root:' su Having this command in your .screenrc would bind the key sequence `C-a R' to the `su' command and give it an auto-title name of `root:'. For this auto-title to work, the screen could look something like this: % !em emacs file.c Here the user typed the csh history command `!em' which ran the previously entered `emacs' command. The window status would show `root:emacs' during the execution of the command, and revert to simply `root:' at its completion. bind o title bind E title "" bind u title (unknown) The first binding doesn't have any arguments, so it would prompt you for a title when you type `C-a o'. The second binding would clear an auto-titles current setting (C-a E). The third binding would set the current window's title to `(unknown)' (C-a u).  File: screen.info, Node: Autonuke, Next: Console, Prev: Naming Windows, Up: Window Settings Autonuke ======== - Command: autonuke STATE (none) Sets whether a clear screen sequence should nuke all the output that has not been written to the terminal. *Note Obuflimit::. - Command: defautonuke STATE (none) Same as the `autonuke' command except that the default setting for new displays is changed. Initial setting is `off'. Note that you can use the special `AN' terminal capability if you want to have a terminal type dependant setting.  File: screen.info, Node: Console, Next: Kill, Prev: Autonuke, Up: Window Settings Console ======= - Command: console [STATE] (none) Grabs or ungrabs the machines console output to a window. When the argument is ommitted the current state is displayed.  File: screen.info, Node: Kill, Next: Login, Prev: Console, Up: Window Settings Kill ==== - Command: kill (`C-a k', `C-a C-k') Kill the current window. If there is an `exec' command running (*note Exec::.) then it is killed. Otherwise the process (e.g. shell) running in the window receives a `HANGUP' condition, the window structure is removed and screen switches to the previously displayed window. When the last window is destroyed, `screen' exits. *Caution*: `emacs' users may find themselves killing their `emacs' session when trying to delete the current line. For this reason, it is probably wise to use a different command character (*note Command Character::.) or rebind `kill' to another key sequence, such as `C-a K' (*note Key Binding::.).  File: screen.info, Node: Login, Next: Mode, Prev: Kill, Up: Window Settings Login ===== - Command: deflogin STATE (none) Same as the `login' command except that the default setting for new windows is changed. This defaults to `on' unless otherwise specified at compile time (*note Installation::.). Both commands are only present when `screen' has been compiled with utmp support. - Command: login [STATE] (`C-a L') Adds or removes the entry in `/etc/utmp' for the current window. This controls whether or not the window is "logged in". In addition to this toggle, it is convenient to have "log in" and "log out" keys. For instance, `bind I login on' and `bind O login off' will map these keys to be `C-a I' and `C-a O' (*note Key Binding::.).  File: screen.info, Node: Mode, Next: Monitor, Prev: Login, Up: Window Settings Mode ==== - Command: defmode MODE (none) The mode of each newly allocated pseudo-tty is set to MODE. MODE is an octal number as used by chmod(1). Defaults to 0622 for windows which are logged in, 0600 for others (e.g. when `-ln' was specified for creation. *note Screen Command::.).  File: screen.info, Node: Monitor, Next: Obuflimit, Prev: Mode, Up: Window Settings Monitoring ========== - Command: activity MESSAGE (none) When any activity occurs in a background window that is being monitored, `screen' displays a notification in the message line. The notification message can be redefined by means of the `activity' command. Each occurrence of `%' in MESSAGE is replaced by the number of the window in which activity has occurred, and each occurrence of `~' is replaced by the definition for bell in your termcap (usually an audible bell). The default message is 'Activity in window %' Note that monitoring is off for all windows by default, but can be altered by use of the `monitor' command (`C-a M'). - Command: defmonitor STATE (none) Same as the `monitor' command except that the default setting for new windows is changed. Initial setting is `off'. - Command: monitor [STATE] (`C-a M') Toggles monitoring of the current window. When monitoring is turned on and the affected window is switched into the background, the activity notification message will be displayed in the status line at the first sign of output, and the window will also be marked with an `@' in the window-status display (*note Windows::.). Monitoring defaults to `off' for all windows.  File: screen.info, Node: Obuflimit, Next: Windows, Prev: Monitor, Up: Window Settings Obuflimit ========= - Command: obuflimit [LIMIT] (none) If the output buffer contains more bytes than the specified limit, no more data will be read from the windows. The default value is 256. If you have a fast display (like `xterm'), you can set it to some higher value. If no argument is specified, the current setting is displayed. - Command: defobuflimit LIMIT (none) Same as the `obuflimit' command except that the default setting for new displays is changed. Initial setting is 256 bytes. Note that you can use the special `OL' terminal capability if you want to have a terminal type dependant limit.  File: screen.info, Node: Windows, Prev: Obuflimit, Up: Window Settings Windows ======= - Command: windows (`C-a w', `C-a C-w') Uses the message line to display a list of all the windows. Each window is listed by number with the name of the program running in the window (or its title); the current window is marked with a `*'; the previous window is marked with a `-'; all the windows that are logged in are marked with a `$' (*note Login::.); a background window that has received a bell is marked with a `!'; a background window that is being monitored and has had activity occur is marked with an `@' (*note Monitor::.); a window which has output logging turned on is marked with `(L)'; windows occupied by other users are marked with `&'; windows in the zombie state are marked with `Z'. If this list is too long to fit on the terminals status line only the portion around the current window is displayed.  File: screen.info, Node: Virtual Terminal, Next: Copy and Paste, Prev: Window Settings, Up: Top Virtual Terminal **************** Each window in a `screen' session emulates a VT100 terminal, with some extra functions added. The commands described here modify the terminal emulation. * Menu: * Control Sequences:: Details of the internal VT100 emulation. * Bell:: Getting your attention. * Clear:: Clear the window display. * Height:: Changing the height of your terminal. * Info:: Terminal emulation statistics. * Redisplay:: When the display gets confusing. * Wrap:: Automatic margins. * Reset:: Recovering from ill-behaved applications. * Width:: Changing the width of your terminal.  File: screen.info, Node: Control Sequences, Next: Bell, Up: Virtual Terminal Control Sequences ================= The following is a list of control sequences recognized by `screen'. `(V)' and `(A)' indicate VT100-specific and ANSI- or ISO-specific functions, respectively. ESC E Next Line ESC D Index ESC M Reverse Index ESC H Horizontal Tab Set ESC Z Send VT100 Identification String ESC 7 (V) Save Cursor and Attributes ESC 8 (V) Restore Cursor and Attributes ESC [s (A) Save Cursor and Attributes ESC [u (A) Restore Cursor and Attributes ESC c Reset to Initial State ESC = (V) Application Keypad Mode ESC > (V) Numeric Keypad Mode ESC # 8 (V) Fill Screen with E's ESC \ (A) String Terminator ESC ^ (A) Privacy Message String (Message Line) ESC ! Global Message String (Message Line) ESC k Title Definition String ESC P (A) Device Control String Outputs a string directly to the host terminal without interpretation. ESC _ (A) Application Program Command (not used) ESC ] (A) Operating System Command (not used) Control-N (A) Lock Shift G1 (SO) Control-O (A) Lock Shift G0 (SI) ESC n (A) Lock Shift G2 ESC o (A) Lock Shift G3 ESC N (A) Single Shift G2 ESC O (A) Single Shift G3 ESC ( Pcs (A) Designate character set as G0 ESC ) Pcs (A) Designate character set as G1 ESC * Pcs (A) Designate character set as G2 ESC + Pcs (A) Designate character set as G3 ESC [ Pn ; Pn H Direct Cursor Addressing ESC [ Pn ; Pn f Direct Cursor Addressing ESC [ Pn J Erase in Display Pn = None or 0 From Cursor to End of Screen 1 From Beginning of Screen to Cursor 2 Entire Screen ESC [ Pn K Erase in Line Pn = None or 0 From Cursor to End of Line 1 From Beginning of Line to Cursor 2 Entire Line ESC [ Pn A Cursor Up ESC [ Pn B Cursor Down ESC [ Pn C Cursor Right ESC [ Pn D Cursor Left ESC [ Ps ;...; Ps m Select Graphic Rendition Ps = None or 0 Default Rendition 1 Bold 2 (A) Faint 3 (A) Standout Mode (ANSI: Italicized) 4 Underlined 5 Blinking 7 Negative Image 22 (A) Normal Intensity 23 (A) Standout Mode off (ANSI: Italicized off) 24 (A) Not Underlined 25 (A) Not Blinking 27 (A) Positive Image ESC [ Pn g Tab Clear Pn = None or 0 Clear Tab at Current Position 3 Clear All Tabs ESC [ Pn ; Pn r (V) Set Scrolling Region ESC [ Pn I (A) Horizontal Tab ESC [ Pn Z (A) Backward Tab ESC [ Pn L (A) Insert Line ESC [ Pn M (A) Delete Line ESC [ Pn @ (A) Insert Character ESC [ Pn P (A) Delete Character ESC [ Ps ;...; Ps h Set Mode ESC [ Ps ;...; Ps l Reset Mode Ps = 4 (A) Insert Mode ?1 (V) Application Cursor Keys ?3 (V) Change Terminal Width to 132 columns ?5 (V) Visible Bell (`On' followed by `Off') ?6 (V) `Origin' Mode ?7 (V) `Wrap' Mode ESC [ 5 i (A) Start relay to printer (ANSI Media Copy) ESC [ 4 i (A) Stop relay to printer (ANSI Media Copy) ESC [ 8 ; Ph ; Pw t Resize the window to `Ph' lines and `Pw' columns (SunView special) ESC [ c Send VT100 Identification String ESC [ 6 n Send Cursor Position Report  File: screen.info, Node: Bell, Next: Clear, Prev: Control Sequences, Up: Virtual Terminal Bell ==== - Command: bell MESSAGE (none) When a bell character is sent to a background window, `screen' displays a notification in the message line. The notification message can be re-defined by means of the `bell' command. Each occurrence of `%' in MESSAGE is replaced by the number of the window to which a bell has been sent, and each occurrence of `~' is replaced by the definition for bell in your termcap (usually an audible bell). The default message is 'Bell in window %' An empty message can be supplied to the `bell' command to suppress output of a message line (`bell ""'). - Command: vbell [STATE] (`C-a C-g') Sets or toggles the visual bell setting for the current window. If your terminal does not support a visual bell, the visual bell message is displayed in the status line. *Note Visual Bell: (termcap)Bell, for more information on visual bells. The equivalent terminfo capability is `flash'. - Command: vbell_msg MESSAGE (none) Sets the visual bell message. MESSAGE is printed to the status line if the window receives a bell character (^G) and `vbell' is set to `on'. The default message is `Wuff, Wuff!!'. - Command: vbellwait SEC (none) Define a delay in seconds after each display of `screen' 's visual bell message. The default is 1 second.  File: screen.info, Node: Clear, Next: Height, Prev: Bell, Up: Virtual Terminal Clear ===== - Command: clear (`C-a C') Clears the screen and saves its contents to the scrollback buffer.  File: screen.info, Node: Height, Next: Info, Prev: Clear, Up: Virtual Terminal Height ====== - Command: height [LINES] (none) Set the display height to a specified number of lines. When no argument is given it toggles between 24 and 42 lines display.  File: screen.info, Node: Info, Next: Redisplay, Prev: Height, Up: Virtual Terminal Info ==== - Command: info (`C-a i', `C-a C-i') Uses the message line to display some information about the current window: the cursor position in the form `(COLUMN,ROW)' starting with `(1,1)', the terminal width and height plus the size of the scrollback buffer in lines, like in `(80,24)+50', various flag settings (flow-control, insert mode, origin mode, wrap mode, application-keypad mode, output logging, activity monitoring, and redraw (`+' indicates enabled, `-' not)), the currently active character set (`G0', `G1', `G2', or `G3'), and in square brackets the terminal character sets that are currently designated as `G0' through `G3'. For system information use `time'.  File: screen.info, Node: Redisplay, Next: Wrap, Prev: Info, Up: Virtual Terminal Redisplay ========= - Command: allpartial STATE (none) If set to on, only the current cursor line is refreshed on window change. This affects all windows and is useful for slow terminal lines. The previous setting of full/partial refresh for each window is restored with `allpartial off'. - Command: partial STATE (none) Defines whether the display should be refreshed (as with `redisplay') after switching to the current window. This command only affects the current window. To affect all windows use the `allpartial' command. Default is `off', of course. - Command: redisplay (`C-a l', `C-a C-l') Redisplay the current window. Needed to get a full redisplay in partial redraw mode.  File: screen.info, Node: Wrap, Next: Reset, Prev: Redisplay, Up: Virtual Terminal Wrap ==== - Command: wrap STATE (`C-a r', `C-a C-r') Sets the line-wrap setting for the current window. When line-wrap is on, the second consecutive printable character output at the last column of a line will wrap to the start of the following line. As an added feature, backspace (^H) will also wrap through the left margin to the previous line. Default is `on'. - Command: defwrap STATE (none) Same as the `wrap' command except that the default setting for new windows is changed. Initially line-wrap is on and can be toggled with the `wrap' command (`C-a r') or by means of "C-a : wrap on|off".  File: screen.info, Node: Reset, Next: Width, Prev: Wrap, Up: Virtual Terminal Reset ===== - Command: reset (`C-a Z') Reset the virtual terminal to its "power-on" values. Useful when strange settings (like scroll regions or graphics character set) are left over from an application.  File: screen.info, Node: Width, Prev: Reset, Up: Virtual Terminal Width ===== - Command: width [NUM] (`C-a W') Toggle the window width between 80 and 132 columns, or set it to NUM columns if an argument is specified. This requires a capable terminal and the termcap entries `Z0' and `Z1'. See the `termcap' command (*note Termcap::.), for more information.  File: screen.info, Node: Copy and Paste, Next: Subprocess Execution, Prev: Virtual Terminal, Up: Top Copy and Paste ************** For those confined to a hardware terminal, these commands provide a cut and paste facility more powerful than those provided by most windowing systems. * Menu: * Copy:: Copy from scrollback to buffer * Paste:: Paste from buffer into window * Registers:: Longer-term storage * Screen-Exchange:: Sharing data between screen users * History:: Recalling previous input  File: screen.info, Node: Copy, Next: Paste, Up: Copy and Paste Copying ======= - Command: copy (`C-a [', `C-a C-[', `C-a ESC') Enter copy/scrollback mode. This allows you to copy text from the current window and its history into the paste buffer. In this mode a `vi'-like full screen editor is active, with controls as outlined below. * Menu: * Line Termination:: End copied lines with CR/LF * Scrollback:: Set the size of the scrollback buffer * Copy Mode Keys:: Remap keys in copy mode * Movement:: Move around in the scrollback buffer * Marking:: Select the text you want * Repeat count:: Repeat a command * Searching:: Find the text you want * Specials:: Other random keys  File: screen.info, Node: Line Termination, Next: Scrollback, Up: Copy CR/LF ----- - Command: crlf STATE (none) This affects the copying of text regions with the `C-a [' command. If it is set to `on', lines will be separated by the two character sequence `CR'/`LF'. Otherwise only `LF' is used. `crlf' is off by default.  File: screen.info, Node: Scrollback, Next: Copy Mode Keys, Prev: Line Termination, Up: Copy Scrollback ---------- - Command: defscrollback NUM (none) Same as the `scrollback' command except that the default setting for new windows is changed. Defaults to 100. - Command: scrollback NUM (none) Set the size of the scrollback buffer for new windows to NUM lines. The default scrollback is 100 lines. Use `C-a i' to view the current setting.  File: screen.info, Node: Copy Mode Keys, Next: Movement, Prev: Scrollback, Up: Copy markkeys -------- - Command: markkeys STRING (none) This is a method of changing the keymap used for copy/history mode. The string is made up of OLDCHAR=NEWCHAR pairs which are separated by `:'. Example: The command `markkeys h=^B:l=^F:$=^E' would set some keys to be more familiar to `emacs' users.  File: screen.info, Node: Movement, Next: Marking, Prev: Copy Mode Keys, Up: Copy Movement Keys ------------- `h', `j', `k', `l' move the cursor line by line or column by column. `0', `^' and `$' move to the leftmost column or to the first or last non-whitespace character on the line. `H', `M' and `L' move the cursor to the leftmost column of the top, center or bottom line of the window. `+' and `-' move the cursor to the leftmost column of the next or previous line. `G' moves to the specified absolute line (default: end of buffer). `|' moves to the specified absolute column. `w', `b', `e' move the cursor word by word. `C-u' and `C-d' scroll the display up/down by the specified amount of lines while preserving the cursor position. (Default: half screenfull). `C-b' and `C-f' move the cursor up/down a full screen. `g' moves to the beginning of the buffer. `%' jumps to the specified percentage of the buffer. Note that Emacs-style movement keys can be specified by a .screenrc command. (`markkeys "h=^B:l=^F:$=^E"') There is no simple method for a full emacs-style keymap, however, as this involves multi-character codes.  File: screen.info, Node: Marking, Next: Repeat count, Prev: Movement, Up: Copy Marking ------- The copy range is specified by setting two marks. The text between these marks will be highlighted. Press `space' to set the first or second mark respectively. `Y' and `y' can be used to mark one whole line or to mark from start of line. `W' marks exactly one word.  File: screen.info, Node: Repeat count, Next: Searching, Prev: Marking, Up: Copy Repeat Count ------------ Any command in copy mode can be prefixed with a number (by pressing digits `0...9') which is taken as a repeat count. Example: `C-a C-[ H 10 j 5 Y' will copy lines 11 to 15 into the pastebuffer.  File: screen.info, Node: Searching, Next: Specials, Prev: Repeat count, Up: Copy Searching --------- `/' `vi'-like search forward. `?' `vi'-like search backward. `C-a s' `emacs' style incremental search forward. `C-r' `emacs' style reverse i-search.  File: screen.info, Node: Specials, Prev: Searching, Up: Copy Specials -------- There are, however, some keys that act differently here from in `vi'. `Vi' does not allow to yank rectangular blocks of text, but `screen' does. Press `c' or `C' to set the left or right margin respectively. If no repeat count is given, both default to the current cursor position. Example: Try this on a rather full text screen: `C-a [ M 20 l SPACE c 10 l 5 j C SPACE'. This moves one to the middle line of the screen, moves in 20 columns left, marks the beginning of the copybuffer, sets the left column, moves 5 columns down, sets the right column, and then marks the end of the copybuffer. Now try: `C-a [ M 20 l SPACE 10 l 5 j SPACE' and notice the difference in the amount of text copied. `J' joins lines. It toggles between 3 modes: lines separated by a newline character (012), lines glued seamless, or lines separated by a single space. Note that you can prepend the newline character with a carriage return character, by issuing a `set crlf on'. `v' is for all the `vi' users who use `:set numbers' - it toggles the left margin between column 9 and 1. `a' before the final space key turns on append mode. Thus the contents of the pastebuffer will not be overwritten, but appended to. `A' turns on append mode and sets a (second) mark. `>' sets the (second) mark and writes the contents of the copybuffer to the screen-exchange file (`/tmp/screen-exchange' per default) once copy-mode is finished. *Note Screen-Exchange::. This example demonstrates how to dump the whole scrollback buffer to that file: `C-a [ g SPACE G $ >'. `C-g' gives information about the current line and column. `@' does nothing. Absolutely nothing. Does not even exit copy mode.  File: screen.info, Node: Paste, Next: Registers, Prev: Copy, Up: Copy and Paste Paste ===== - Command: paste [REGISTERS] (`C-a ]', `C-a C-]') Write the contents of the specified registers to the stdin stream of the current window. The register `.' is treated as the paste buffer. If no parameter is given only the paste buffer is used. The paste buffer can be filled with the `copy', `history' and `readbuf' commands. - Command: slowpaste MSEC (none) Define the speed text is inserted by the `paste' command. If the slowpaste value is nonzero text is written character by character. `screen' will pause for MSEC milliseconds after each write to allow the application to process the input. only use `slowpaste' if your underlying system exposes flow control problems while pasting large amounts of text.  File: screen.info, Node: Registers, Next: Screen-Exchange, Prev: Paste, Up: Copy and Paste Registers ========= - Command: copy_reg [KEY] (none) Store the current copybuffer contents in a register referenced by KEY. If the name is omitted you will be prompted to press the key. - Command: ins_reg [KEY] (none) Paste contents of register KEY into the current window's input stream. - Command: process [KEY] (none) Stuff the contents of the specified register into the `screen' input queue. If no argument is given you are prompted for a register name. The text is parsed as if it had been typed in from the users keyboard. This command can be used to bind multiple actions to a single key. - Command: register KEY STRING (none) Save the specified STRING to the register KEY.  File: screen.info, Node: Screen-Exchange, Next: History, Prev: Registers, Up: Copy and Paste Screen-Exchange =============== - Command: bufferfile [EXCHANGE-FILE] (none) Change the filename used for reading and writing with the copybuffer. If the EXCHANGE-FILE parameter is omitted, `screen' reverts to the default of `/tmp/screen-exchange'. The following example will paste the system's password file into the screen window: C-a : bufferfile /etc/passwd C-a < C-a ] - Command: readbuf (`C-a <') Reads the contents of the current screen-exchange file into the copy buffer. - Command: removebuf (`C-a =') Unlinks the screen-exchange file. - Command: writebuf (`C-a >') Writes the contents of the paste buffer to a public accessible screen-exchange file. This is thought of as a primitive means of communication between `screen' users on the same host. See also `C-a ESC' (*note Copy::.).  File: screen.info, Node: History, Prev: Screen-Exchange, Up: Copy and Paste History ======= - Command: history (`C-a {') Usually users work with a shell that allows easy access to previous commands. For example, `csh' has the command `!!' to repeat the last command executed. `screen' provides a primitive way of recalling "the command that started ...": You just type the first letter of that command, then hit `C-a {' and `screen' tries to find a previous line that matches with the prompt character to the left of the cursor. This line is pasted into this window's input queue. Thus you have a crude command history (made up by the visible window and its scrollback buffer).  File: screen.info, Node: Subprocess Execution, Next: Key Binding, Prev: Copy and Paste, Up: Top Subprocess Execution ******************** Control Input or Output of a window by another filter process. Use with care! * Menu: * Exec:: The `exec' command syntax. * Using Exec:: Weird things that filters can do.  File: screen.info, Node: Exec, Next: Using Exec, Up: Subprocess Execution Exec ==== - Command: exec [[FDPAT] NEWCOMMAND [ARGS ... ]] (none) Run a unix subprocess (specified by an executable path NEWCOMMAND and its optional arguments) in the current window. The flow of data between newcommands stdin/stdout/stderr, the process already running (shell) and screen itself (window) is controlled by the filedescriptor pattern FDPAT. This pattern is basically a three character sequence representing stdin, stdout and stderr of newcommand. A dot (`.') connects the file descriptor to screen. An exclamation mark (`!') causes the file descriptor to be connected to the already running process. A colon (`:') combines both. User input will go to newcommand unless newcommand requests the old process' output (FDPATs first character is `!' or `:') or a pipe symbol (`|') is added to the end of FDPAT. Invoking `exec' without arguments shows name and arguments of the currently running subprocess in this window. When a subprocess is running the `kill' command will affect it instead of the windows process. Refer to the postscript file `doc/fdpat.ps' for illustration of all 21 possible combinations. Each drawing shows the numbers 210 representing the three file descriptors of newcommand. The box marked `W' is usual pty that has the old process (shell) on its slave side. The box marked `P' is the secondary pty that now has screen at its master side.  File: screen.info, Node: Using Exec, Prev: Exec, Up: Subprocess Execution Using Exec ========== Abbreviations: * Whitespace between the word `exec' and FDPAT and the command name can be omitted. * Trailing dots and a FDPAT consisting only of dots can be omitted. * A simple `|' is synonymous for the `!..|' pattern. * The word `exec' can be ommitted when the `|' abbreviation is used. * The word `exec' can always be replaced by leading `!'. Examples: `!/bin/sh' `exec /bin/sh' `exec ... /bin/sh' Creates another shell in the same window, while the orignal shell is still running. Output of both shells is displayed and user input is sent to the new `/bin/sh'. `!!stty 19200' `exec!stty 19200' `exec !.. stty 19200' Set the speed of the windows tty. If your stty command operates on stdout, then add another `!'. This is a useful command, when a screen window is directly connected to a serial line that needs to be configured. `|less' `exec !..| less' This adds a pager to the window output. The special character `|' is needed to give the user control over the pager although it gets its input from the windows process. This works, because `less' listens on stderr (a behavior that `screen' would not expect without the `|') when its stdin is not a tty. `!:sed -n s/.*Error.*/\007/p' Sends window output to both, the user and the sed command. The sed inserts an additional bell character (oct. 007) to the window output seen by screen. This will cause 'Bell in window x' messages, whenever the string `Error' appears in the window.  File: screen.info, Node: Key Binding, Next: Flow Control, Prev: Subprocess Execution, Up: Top Key Binding *********** You may disagree with some of the default bindings (I know I do). The `bind' command allows you to redefine them to suit your preferences. * Menu: * Bind:: `bind' syntax. * Bind Examples:: Using `bind'. * Command Character:: The character used to start keyboard commands. * Help:: Show current key bindings.  File: screen.info, Node: Bind, Next: Bind Examples, Up: Key Binding The `bind' command ================== - Command: bind KEY [COMMAND [ARGS]] (none) Bind a command to a key. The KEY argument is either a single character, a two-character sequence of the form `^x' (meaning `C-x'), a backslash followed by an octal number (specifying the ASCII code of the character), or a backslash followed by a second character, such as `\^' or `\\'. The argument can also be quoted, if you like. If no further argument is given, any previously established binding for this key is removed. The COMMAND argument can be any command (*note Command Index::.). By default, most suitable commands are bound to one or more keys (*note Default Key Bindings::.; for instance, the command to create a new window is bound to `C-c' and `c'. The `bind' command can be used to redefine the key bindings and to define new bindings.  File: screen.info, Node: Bind Examples, Next: Command Character, Prev: Bind, Up: Key Binding Examples of the `bind' command ============================== Some examples: bind ' ' windows bind ^f screen telnet foobar bind \033 screen -ln -t root -h 1000 9 su would bind the space key to the command that displays a list of windows (so that the command usually invoked by `C-a C-w' would also be available as `C-a space'), bind `C-f' to the command "create a window with a TELNET connection to foobar", and bind ESC to the command that creates an non-login window with title `root' in slot #9, with a super-user shell and a scrollbackbuffer of 1000 lines.  File: screen.info, Node: Command Character, Next: Help, Prev: Bind Examples, Up: Key Binding Command Character ================= - Command: escape XY (none) Set the command character to X and the character generating a literal command character to Y (just like with the `-e' option). Each argument is either a single character, a two-character sequence of the form `^x' (meaning `C-x'), a backslash followed by an octal number (specifying the ASCII code of the character), or a backslash followed by a second character, such as `\^' or `\\'. The default is `^Aa', but ```' is recommended by one of the authors. - Command: meta (`C-a a') Send the command character (`C-a') to the process in the current window. The keystroke for this command is the second parameter to the `-e' command line switch (*note Invoking Screen::.), or the `escape' .screenrc directive.  File: screen.info, Node: Help, Prev: Command Character, Up: Key Binding Help ==== - Command: help (`C-a ?') Displays a help screen showing you all the key bindings. The first pages list all the internal commands followed by their bindings. Subsequent pages will display the custom commands, one command per key. Press space when you're done reading each page, or return to exit early. All other characters are ignored, except for the command character, which will exit the help display and begin a command. *Note Default Key Bindings::.  File: screen.info, Node: Flow Control, Next: Termcap, Prev: Key Binding, Up: Top Flow Control ************ `screen' can trap flow control characters or pass them to the program, as you see fit. This is useful when your terminal wants to use XON/XOFF flow control and you are running a program which wants to use ^S/^Q for other purposes (i.e. `emacs'). * Menu: * Flow Control Summary:: The effect of `screen' flow control * Flow:: Setting the flow control behavior * XON/XOFF:: Sending XON or XOFF to the window  File: screen.info, Node: Flow Control Summary, Next: Flow, Up: Flow Control About `screen' flow control settings ==================================== Each window has a flow-control setting that determines how screen deals with the XON and XOFF characters (and perhaps the interrupt character). When flow-control is turned off, screen ignores the XON and XOFF characters, which allows the user to send them to the current program by simply typing them (useful for the `emacs' editor, for instance). The trade-off is that it will take longer for output from a "normal" program to pause in response to an XOFF. With flow-control turned on, XON and XOFF characters are used to immediately pause the output of the current window. You can still send these characters to the current program, but you must use the appropriate two-character screen commands (typically `C-a q' (xon) and `C-a s' (xoff)). The xon/xoff commands are also useful for typing C-s and C-q past a terminal that intercepts these characters. Each window has an initial flow-control value set with either the `-f' option or the `defflow' command. By default the windows are set to automatic flow-switching. It can then be toggled between the three states 'fixed on', 'fixed off' and 'automatic' interactively with the `flow' command bound to `C-a f'. The automatic flow-switching mode deals with flow control using the TIOCPKT mode (like `rlogin' does). If the tty driver does not support TIOCPKT, screen tries to determine the right mode based on the current setting of the application keypad -- when it is enabled, flow-control is turned off and visa versa. Of course, you can still manipulate flow-control manually when needed. If you're running with flow-control enabled and find that pressing the interrupt key (usually C-c) does not interrupt the display until another 6-8 lines have scrolled by, try running screen with the `interrupt' option (add the `interrupt' flag to the `flow' command in your .screenrc, or use the `-i' command-line option). This causes the output that `screen' has accumulated from the interrupted program to be flushed. One disadvantage is that the virtual terminal's memory contains the non-flushed version of the output, which in rare cases can cause minor inaccuracies in the output. For example, if you switch screens and return, or update the screen with `C-a l' you would see the version of the output you would have gotten without `interrupt' being on. Also, you might need to turn off flow-control (or use auto-flow mode to turn it off automatically) when running a program that expects you to type the interrupt character as input, as the `interrupt' parameter only takes effect when flow-control is enabled. If your program's output is interrupted by mistake, a simple refresh of the screen with `C-a l' will restore it. Give each mode a try, and use whichever mode you find more comfortable.  File: screen.info, Node: Flow, Next: XON/XOFF, Prev: Flow Control Summary, Up: Flow Control Flow ==== - Command: defflow FSTATE [INTERRUPT] (none) Same as the `flow' command except that the default setting for new windows is changed. Initial setting is `auto'. Specifying `flow auto interrupt' has the same effect as the command-line options `-fa' and `-i'. - Command: flow [FSTATE] (`C-a f', `C-a C-f') Sets the flow-control mode for this window to FSTATE, which can be `on', `off' or `auto'. Without parameters it cycles the current window's flow-control setting. Default is set by `defflow'.  File: screen.info, Node: XON/XOFF, Prev: Flow, Up: Flow Control XON and XOFF ============ - Command: xon (`C-a q', `C-a C-q') Send a ^Q (ASCII XON) to the program in the current window. Redundant if flow control is set to `off' or `auto'. - Command: xoff (`C-a s', `C-a C-s') Send a ^S (ASCII XOFF) to the program in the current window.  File: screen.info, Node: Termcap, Next: Message Line, Prev: Flow Control, Up: Top Termcap ******* `screen' demands the most out of your terminal so that it can perform its VT100 emulation most efficiently. These functions provide means for tweaking the termcap entries for both your physical terminal and the one simulated by `screen'. * Menu: * Window Termcap:: Choosing a termcap entry for the window. * Dump Termcap:: Write out a termcap entry for the window. * Termcap Syntax:: The `termcap' and `terminfo' commands. * Termcap Examples:: Uses for `termcap'. * Special Capabilities:: Non-standard capabilities used by `screen'.  File: screen.info, Node: Window Termcap, Next: Dump Termcap, Up: Termcap Choosing the termcap entry for a window ======================================= Usually `screen' tries to emulate as much of the VT100/ANSI standard as possible. But if your terminal lacks certain capabilities the emulation may not be complete. In these cases `screen' has to tell the applications that some of the features are missing. This is no problem on machines using termcap, because `screen' can use the `$TERMCAP' variable to customize the standard screen termcap. But if you do a rlogin on another machine or your machine supports only terminfo this method fails. Because of this `screen' offers a way to deal with these cases. Here is how it works: When `screen' tries to figure out a terminal name for itself, it first looks for an entry named `screen.TERM', where TERM is the contents of your `$TERM' variable. If no such entry exists, `screen' tries `screen' (or `screen-w', if the terminal is wide (132 cols or more)). If even this entry cannot be found, `vt100' is used as a substitute. The idea is that if you have a terminal which doesn't support an important feature (e.g. delete char or clear to EOS) you can build a new termcap/terminfo entry for `screen' (named `screen.DUMBTERM') in which this capability has been disabled. If this entry is installed on your machines you are able to do a rlogin and still keep the correct termcap/terminfo entry. The terminal name is put in the `$TERM' variable of all new windows. `screen' also sets the `$TERMCAP' variable reflecting the capabilities of the virtual terminal emulated. Furthermore, the variable `$WINDOW' is set to the window number of each window. The actual set of capabilities supported by the virtual terminal depends on the capabilities supported by the physical terminal. If, for instance, the physical terminal does not support underscore mode, `screen' does not put the `us' and `ue' capabilities into the window's `$TERMCAP' variable, accordingly. However, a minimum number of capabilities must be supported by a terminal in order to run `screen'; namely scrolling, clear screen, and direct cursor addressing (in addition, `screen' does not run on hardcopy terminals or on terminals that over-strike). Also, you can customize the `$TERMCAP' value used by `screen' by using the `termcap' command, or by defining the variable `$SCREENCAP' prior to startup. When the latter defined, its value will be copied verbatim into each window's `$TERMCAP' variable. This can either be the full terminal definition, or a filename where the terminal `screen' (and/or `screen-w') is defined. Note that `screen' honors the `terminfo' command if the system uses the terminfo database rather than termcap. On such machines the `$TERMCAP' variable has no effect and you must use the `dumptermcap' command (*note Dump Termcap::.) and the `tic' program to generate terminfo entries for `screen' windows. When the boolean `G0' capability is present in the termcap entry for the terminal on which `screen' has been called, the terminal emulation of `screen' supports multiple character sets. This allows an application to make use of, for instance, the VT100 graphics character set or national character sets. The following control functions from ISO 2022 are supported: `lock shift G0' (`SI'), `lock shift G1' (`SO'), `lock shift G2', `lock shift G3', `single shift G2', and `single shift G3'. When a virtual terminal is created or reset, the ASCII character set is designated as `G0' through `G3'. When the `G0' capability is present, screen evaluates the capabilities `S0', `E0', and `C0' if present. `S0' is the sequence the terminal uses to enable and start the graphics character set rather than `SI'. `E0' is the corresponding replacement for `SO'. `C0' gives a character by character translation string that is used during semi-graphics mode. This string is built like the `acsc' terminfo capability. When the `po' and `pf' capabilities are present in the terminal's termcap entry, applications running in a `screen' window can send output to the printer port of the terminal. This allows a user to have an application in one window sending output to a printer connected to the terminal, while all other windows are still active (the printer port is enabled and disabled again for each chunk of output). As a side-effect, programs running in different windows can send output to the printer simultaneously. Data sent to the printer is not displayed in the window. Some capabilities are only put into the `$TERMCAP' variable of the virtual terminal if they can be efficiently implemented by the physical terminal. For instance, `dl' (delete line) is only put into the `$TERMCAP' variable if the terminal supports either delete line itself or scrolling regions. Note that this may provoke confusion, when the session is reattached on a different terminal, as the value of `$TERMCAP' cannot be modified by parent processes. You can force `screen' to include all capabilities in `$TERMCAP' with the `-a' command-line option (*note Invoking Screen::.).  File: screen.info, Node: Dump Termcap, Next: Termcap Syntax, Prev: Window Termcap, Up: Termcap Write out the window's termcap entry ==================================== - Command: dumptermcap (`C-a .') Write the termcap entry for the virtual terminal optimized for the currently active window to the file `.termcap' in the user's `$HOME/.screen' directory (or wherever `screen' stores its sockets. *note Files::.). This termcap entry is identical to the value of the environment variable `$TERMCAP' that is set up by `screen' for each window. For terminfo based systems you will need to run a converter like `captoinfo' and then compile the entry with `tic'.  File: screen.info, Node: Termcap Syntax, Next: Termcap Examples, Prev: Dump Termcap, Up: Termcap The `termcap' command ===================== - Command: termcap TERM TERMINAL-TWEAKS [WINDOW-TWEAKS] - Command: terminfo TERM TERMINAL-TWEAKS [WINDOW-TWEAKS] (none) Use this command to modify your terminal's termcap entry without going through all the hassles involved in creating a custom termcap entry. Plus, you can optionally customize the termcap generated for the windows. If your system uses the terminfo database rather than termcap, `screen' will understand the `terminfo' command which has the same effects as the `termcap' command. Thus users can write one .screenrc file that handles both cases, although terminfo syntax is slightly different from termcap syntax. The first argument specifies which terminal(s) should be affected by this definition. You can specify multiple terminal names by separating them with `|'s. Use `*' to match all terminals and `vt*' to match all terminals that begin with `vt'. Each TWEAK argument contains one or more termcap defines (separated by `:'s) to be inserted at the start of the appropriate termcap entry, enhancing it or overriding existing values. The first tweak modifies your terminal's termcap, and contains definitions that your terminal uses to perform certain functions. Specify a null string to leave this unchanged (e.g. ""). The second (optional) tweak modifies all the window termcaps, and should contain definitions that screen understands (*note Virtual Terminal::.). .