Go to the previous, next section.

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.

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 [ > c                       Send Secondary Device Attributes String
ESC [ 6 n                       Send Cursor Position Report

Input Translation

In order to do a full VT100 emulation screen has to detect that a sequence of characters in the input stream was generated by a keypress on the user's keyboard and insert the VT100 style escape sequence. Screen has a very flexible way of doing this by making it possible to map arbitrary commands on arbitrary sequences of characters. For standard VT100 emulation the command will always insert a string in the input buffer of the window (see also command stuff, see section Paste). Because the sequences generated by a keypress can change after a reattach from a different terminal type, it is possible to bind commands to the termcap name of the keys. Screen will insert the correct binding after each reattach. See section Bindkey for further details on the syntax and examples.

Here is the table of the default key bindings. (A) means that the command is executed if the keyboard is switched into application mode.

Key name        Termcap name    Command
Cursor up            ku         stuff \033[A
                                stuff \033OA      (A)
Cursor down          kd         stuff \033[B
                                stuff \033OB      (A)
Cursor right         kr         stuff \033[C
                                stuff \033OC      (A)
Cursor left          kl         stuff \033[D
                                stuff \033OD      (A)
Function key 0       k0         stuff \033[10~
Function key 1       k1         stuff \033OP
Function key 2       k2         stuff \033OQ
Function key 3       k3         stuff \033OR
Function key 4       k4         stuff \033OS
Function key 5       k5         stuff \033[15~
Function key 6       k6         stuff \033[17~
Function key 7       k7         stuff \033[18~
Function key 8       k8         stuff \033[19~
Function key 9       k9         stuff \033[20~
Function key 10      k;         stuff \033[21~
Function key 11      F1         stuff \033[22~
Function key 12      F2         stuff \033[23~
Backspace            kb         stuff \010
Home                 kh         stuff \033[1~
End                  kH         stuff \033[4~
Insert               kI         stuff \033[2~
Delete               kD         stuff \033[3~
Page up              kP         stuff \033[5~
Page down            kN         stuff \033[6~
Keypad 0             f0         stuff 0
                                stuff \033Op      (A)
Keypad 1             f1         stuff 1
                                stuff \033Oq      (A)
Keypad 2             f2         stuff 2
                                stuff \033Or      (A)
Keypad 3             f3         stuff 3
                                stuff \033Os      (A)
Keypad 4             f4         stuff 4
                                stuff \033Ot      (A)
Keypad 5             f5         stuff 5
                                stuff \033Ou      (A)
Keypad 6             f6         stuff 6
                                stuff \033Ov      (A)
Keypad 7             f7         stuff 7
                                stuff \033Ow      (A)
Keypad 8             f8         stuff 8
                                stuff \033Ox      (A)
Keypad 9             f9         stuff 9
                                stuff \033Oy      (A)
Keypad +             f+         stuff +
                                stuff \033Ok      (A)
Keypad -             f-         stuff -
                                stuff \033Om      (A)
Keypad *             f*         stuff *
                                stuff \033Oj      (A)
Keypad /             f/         stuff /
                                stuff \033Oo      (A)
Keypad =             fq         stuff =
                                stuff \033OX      (A)
Keypad .             f.         stuff .
                                stuff \033On      (A)
Keypad ,             f,         stuff ,
                                stuff \033Ol      (A)
Keypad enter         fe         stuff \015
                                stuff \033OM      (A)


Command: bell_msg [message]

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_msg command to suppress output of a message line (bell_msg "").

Command: vbell [state]

(C-a C-g)
Sets or toggles the visual bell setting for the current window. If vbell is switched to `on', but your terminal does not support a visual bell, the visual bell message is displayed in the status line when the bell character is received. Visual bell support of a terminal is defined by the termcap variable vb. See section `Visual Bell' in The Termcap Manual, for more information on visual bells. The equivalent terminfo capability is flash.

Per default, vbell is `off', thus the audible bell is used.

Command: vbell_msg [message]

Sets the visual bell message. message is printed to the status line if the window receives a bell character (^G), vbell is set to `on' and the terminal does not support a visual bell. The default message is `Wuff, Wuff!!'. Without parameter, the current message is shown.

Command: vbellwait sec

Define a delay in seconds after each display of screen 's visual bell message. The default is 1 second.


Command: clear

(C-a C)
Clears the screen and saves its contents to the scrollback buffer.


Command: height [lines]

Set the display height to a specified number of lines. When no argument is given it toggles between 24 and 42 lines display.


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.


Command: allpartial state

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. This is a global flag that immediately takes effect on all windows overriding the partial settings. It does not change the default redraw behaviour of newly created windows.

Command: partial state

Defines whether the display should be refreshed (as with redisplay) after switching to the current window. This command only affects the current window. To immediately affect all windows use the allpartial command. Default is `off', of course. This default is fixed, as there is currently no defpartial command.

Command: redisplay

(C-a l, C-a C-l)
Redisplay the current window. Needed to get a full redisplay in partial redraw mode.


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

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".


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.


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 (see section Termcap), for more information.

Character Processing

Command: c1 [state]

Change c1 code processing. `c1 on' tells screen to treat the input characters between 128 and 159 as control functions. Such an 8-bit code is normally the same as ESC followed by the corresponding 7-bit code. The default setting is to process c1 codes and can be changed with the `defc1' command. Users with fonts that have usable characters in the c1 positions may want to turn this off.

Command: gr [state]

Turn GR charset switching on/off. Whenever screens sees an input char with an 8th bit set, it will use the charset stored in the GR slot and print the character with the 8th bit stripped. The default (see also `defgr') is not to process GR switching because otherwise the ISO88591 charset would not work.

Command: kanji wtype [dtype]

Tell screen how to process kanji input/output. wtype and dtype must be one of the strings `jis', `euc' or `sjis'. The first argument sets the kanji type of the current window. Each window can emulate a different type. The optional second parameter tells screen how to write the kanji codes to the connected terminal. The preferred method of setting the display type is to use the `KJ' termcap entry. See section Special Terminal Capabilities. See also `defkanji', which changes the default setting of a new window.

Command: defc1 state

Same as the `c1' command except that the default setting for new windows is changed. Initial setting is `on'.

Command: defgr state

Same as the `gr' command except that the default setting for new windows is changed. Initial setting is `off'.

Command: defkanji wtype

Same as the `kanji' command except that the default setting for new windows is changed. Initial setting is `off', i.e. `jis'.

Go to the previous, next section.