Each window in a screen session emulates a VT100 terminal, with
some extra functions added. The VT100 emulator is hard-coded, no
other terminal types can be emulated.
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. Notice that,
however, on machines using the terminfo database this variable
has no effect. 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" .screenrc command, or by defining the
variable $SCREENCAP prior to startup. When the latter is
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" .screenrc command if the
system uses the terminfo database rather than termcap.
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. The
info command displays a line starting `PRIN' while the printer is
active.
Screen maintains a hardstatus line for every window. If a window
gets selected, the display's hardstatus will be updated to match
the window's hardstatus line. If the display has no hardstatus
the line will be displayed as a standard screen message. The
hardstatus line can be changed with the ANSI Application Program
Command (APC): "ESC_<string>ESC\". As a convenience for xterm
users the sequence "ESC]0..2;<string>^G" is also accepted.
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.
The "alternate screen" capability is not enabled by default. Set
the altscreen
.screenrc command to enable it.
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 g
Visual Bell
ESC
Pn p
Cursor Visibility (97801)
Pn = 6
Invisible
Pn = 7
Visible
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
A.k.a. Definition String
ESC P
(A)
Device Control String. Outputs a string directly to the
host terminal without interpretation.
ESC _
(A)
Application Program Command (Hardstatus)
ESC ] 0 ; string ^G
(A)
Operating System Command (Hardstatus, xterm title hack)
ESC ] 83 ; cmd ^G
(A)
Execute screen command. This only works if multi-user
support is compiled into screen. The pseudo-user
":window:" is used to check the access control list. Use
"addacl :window: -rwx #?" to create a user with no rights
and allow only the needed commands.
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
same as above
ESC [
Pn J
Erase in Display
Pn = None or 0
From Cursor to End of Screen
Pn = 1
From Beginning of Screen to Cursor
Pn = 2
Entire Screen
ESC [
Pn K
Erase in Line
Pn = None or 0
From Cursor to End of Line
Pn = 1
From Beginning of Line to Cursor
Pn = 2
Entire Line
ESC [
Pn X
Erase character
ESC [
Pn A
Cursor Up
ESC [
Pn B
Cursor Down
ESC [
Pn C
Cursor Right
ESC [
Pn D
Cursor Left
ESC [
Pn E
Cursor next line
ESC [
Pn F
Cursor previous line
ESC [
Pn G
Cursor horizontal position
ESC [
Pn `
same as above
ESC [
Pn d
Cursor vertical position
ESC [
Ps ;
...;
Ps m
Select Graphic Rendition
Ps = None or 0
Default Rendition
Ps = 1
Bold
Ps = 2
(A)
Faint
Ps = 3
(A)
Standout Mode (ANSI: Italicized)
Ps = 4
Underlined
Ps = 5
Blinking
Ps = 7
Negative Image
Ps = 22
(A)
Normal Intensity
Ps = 23
(A)
Standout Mode off (ANSI: Italicized off)
Ps = 24
(A)
Not Underlined
Ps = 25
(A)
Not Blinking
Ps = 27
(A)
Positive Image
Ps = 30
(A)
Foreground Black
Ps = 31
(A)
Foreground Red
Ps = 32
(A)
Foreground Green
Ps = 33
(A)
Foreground Yellow
Ps = 34
(A)
Foreground Blue
Ps = 35
(A)
Foreground Magenta
Ps = 36
(A)
Foreground Cyan
Ps = 37
(A)
Foreground White
Ps = 39
(A)
Foreground Default
Ps = 40
(A)
Background Black
Ps = ...
Ps = 49
(A)
Background Default
ESC [
Pn g
Tab Clear
Pn = None or 0
Clear Tab at Current Position
Pn = 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 [
Pn S
Scroll Scrolling Region Up
ESC [
Pn T
Scroll Scrolling Region Down
ESC [
Pn ^
same as above
ESC [
Ps ;
...;
Ps h
Set Mode
ESC [
Ps ;
...;
Ps l
Reset Mode
Ps = 4
(A)
Insert Mode
Ps = 20
(A)
Automatic Linefeed Mode
Ps = 34
Normal Cursor Visibility
Ps = ?1
(V)
Application Cursor Keys
Ps = ?3
(V)
Change Terminal Width to 132 columns
Ps = ?5
(V)
Reverse Video
Ps = ?6
(V)
Origin Mode
Ps = ?7
(V)
Wrap Mode
Ps = ?9
X10 mouse tracking
Ps = ?25
(V)
Visible Cursor
Ps = ?47
Alternate Screen (old xterm code)
Ps = ?1000
(V)
VT200 mouse tracking
Ps = ?1047
Alternate Screen (new xterm code)
Ps = ?1049
Alternate Screen (new xterm code)
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 [ x
Send Terminal Parameter Report
ESC [ > c
Send VT220 Secondary Device Attributes String
ESC [ 6 n
Send Cursor Position Report