SCREEN

Section: User Commands (1)
Updated: 2 March 1987
Index Return to Main Contents
 

NAME

screen - screen manager with VT100/ANSI terminal emulation  

SYNOPSIS

screen [ -a ] [ -f ] [ -n ] [ -exy ] [ cmd args ]  

DESCRIPTION

screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells). Each virtual terminal provides the functions of the DEC VT100 terminal and, in addition, several control functions from the ANSI X3.64 (ISO 6429) standard (e.g. insert/delete line).

When screen is called, it creates a single window with a shell; the pathname of the shell is taken from the environment symbol $SHELL; if this is not defined, "/bin/sh" is used. New windows can be created at any time by calling screen from within a previously created window. The program to be started in a newly created window and optional arguments to the program can be supplied when screen is invoked. For instance,

screen csh

will create a window with a C-Shell and switch to that window. When the process associated with the currently displayed window terminates (e.g. ^D has been typed to a shell), screen switches to the previously displayed window; when no more windows are left, screen exits.

When "/etc/utmp" is writable by screen, an appropriate record is written to this file for each window and removed when the window is terminated.  

COMMAND KEYS

The standard way to create a new window is to type "C-a c" (the notation "C-x" will be used as a shorthand for Control-x in this manual; x is an arbitrary letter). "C-a c" creates a new window running a shell and switches to that window immediately, regardless of the state of the process running in the current window. Screen recognizes several such commands; each command consists of "C-a" followed by a one-letter function. For convenience, the letter after a "C-a" can be entered both with or without the control key pressed (with the exception of "C-a C-a" and "C-a a"; see below), thus, "C-a c" as well as "C-a C-c" can be used to create a window.

The following commands are recognized by screen:

C-a c or C-a C-c
Create a new window with a shell and switch to that window.
C-a k or C-a C-k
Kill the current window and switch to the previously displayed window.
C-a C-\
Kill all windows and terminate screen.
C-a C-a     
Switch to the previously displayed window.
C-a 0 to C-a 9
Switch to the window with the number 0 (1, 2, .., 9, respectively). When a new window is established, the first available number from the range 0..9 is assigned to this window. Thus, the first window can be activated by "C-a 0"; at most 10 windows can be present at any time.
C-a space or C-a C-space or C-a n or C-a C-n
Switch to the next window. This function can be used repeatedly to cycle through the list of windows. (Control-space is not supported by all terminals.)
C-a p or C-a C-p or C-a -
Switch to the previous window (the opposite of C-a space).
C-a l or C-a C-l
Redisplay the current window.
C-a z or C-a C-z
Suspend screen.
C-a h or C-a C-h
Write a hardcopy of the current window to the file "hardcopy.n" in the window's current directory, where n is the number of the current window.
C-a . (Control-a dot)
Write the termcap entry for the virtual terminal of the currently active window to the file ".termcap" in the directory "$HOME/.screen". This termcap entry is identical to the value of the environment symbol TERMCAP that is set up by screen for each window.
C-a w or C-a C-w
Display a list of all windows. For each window, the number of the window and the process that has been started in the window is displayed; the current window is marked with a `*'.
C-a t or C-a C-t
Print in the message line the time of day, the host name, the load averages over 1, 5, and 15 minutes (if this is available on your system), the cursor position of the current window in the form "(colum,row)" starting with "(0,0)", and an indication if flow control and (for the current window) insert mode, origin mode, wrap mode, and keypad application mode are enabled or not (indicated by a '+' or '-').
C-a v or C-a C-v
Display the version.
C-a a     
Send the character "C-a" to the processes running in the window.
C-a s or C-a C-s
Send a Control-s to the program running in the window.
C-a q or C-a C-q
Send a Control-q to the program running in the window.

The -e option can be used to specify a different command character and a character which, when typed immediately after the command character, generates a literal command character. The defaults for these two characters are "C-a" and `a'. (Note that the function to switch to the previous window is actually the command character typed twice; for instance, when screen is called with the option "-e]x" (or "-e ]x"), this function becomes "]]").  

CUSTOMIZATION

When screen is invoked, it executes initialization commands from the file ".screenrc" in the user's home directory. Commands in ".screenrc" are mainly used to automatically establish a number of windows each time screen is called, and to bind functions to specific keys. Each line in ".screenrc" contains one initialization command; lines starting with `#' are ignored. Commands can have arguments; arguments are separated by tabs and spaces and can be surrounded by single quotes or double quotes.

The following initialization commands are recognized by screen:

escape xy

Set the command character to x and the character generating a literal command character to y (see the -e option above).

bell message

When a bell character is sent to a background window, screen displays a notification in the message line (see below). 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. 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 "").

screen [n] [cmds args]

Establish a window. If an optional number n in the range 0..9 is given, the window number n is assigned to the newly created window (or, if this number is already in use, the next higher number). Note that n has a value of zero for the standard shell window created after ".screenrc" has been read. If a command is specified after "screen", this command (with the given arguments) is started in the window; if no command is given, a shell is created in the window. Thus, if your ".screenrc" contains the lines

     # example for .screenrc:
     screen 1
     screen 2 telnet foobar

screen creates a shell window (window #1), a window with a TELNET connection to the machine foobar (window #2), and, finally, a second shell window (the default window) which gets a window number of zero. When the initialization is completed, screen always switches to the default window, so window #0 is displayed when the above ".screenrc" is used.

chdir [directory]

Change the current directory of screen to the specified directory or, if called without an argument, to the home directory (the value of the environment symbol $HOME). All windows that are created by means of the "screen" command from within ".screenrc" or by means of "C-a c'' are running in the current directory; the current directory is initially the directory from which the shell command screen has been invoked. Hardcopy files are always written to the directory in which the current window has been created (that is, not in the current directory of the shell running in the window).

bind key [function | cmd args]

Bind a function to a key. By default, each function provided by screen is bound to one or more keys as indicated by the above table, e.g. the function 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. The key argument is either a single character, a sequence of the form "^x" meaning "C-x", or an octal number specifying the ASCII code of the character. If no further argument is given, any previously established binding for this key is removed. The function argument can be one of the following keywords:

     shell        Create new window with a shell
     kill         Kill the current window
     quit         Kill all windows and terminate
     other        Switch to previously displayed window
     next         Switch to the next window
     prev         Switch to the previous window
     redisplay    Redisplay current window
     hardcopy     Make hardcopy of current window
     termcap      Write termcap entry to $HOME/.screen/.termcap
     suspend      Suspend screen
     windows      Display list of window
     info         Print useful information in the message line
     xon          Send Control-q
     xoff         Send Control-s
     version      Display the version
     select0      Switch to window #0
       ...
     select9      Switch to window #9

In addition, a key can be bound such that a window is created running a different command than the shell when that key is pressed. In this case, the command optionally followed by arguments must be given instead of one of the above-listed keywords. For example, the commands

     bind ' ' windows
     bind ^f telnet foobar
     bind 033 su

would bind the space key to the function that displays a list of windows (that is, the function usually invoked by "C-a C-w" or "C-a w" would also be available as "C-a space"), bind "C-f" to the function "create a window with a TELNET connection to foobar", and bind "escape" to the function that creates a window with a super-user shell.  

VIRTUAL TERMINAL

Screen prints error messages and other diagnostics in a message line above the bottom of the screen. The message line is removed when a key is pressed or, automatically, after a couple of seconds. The message line facility can be used by an application running in the current window by means of the ANSI Privacy message control sequence (for instance, from within the shell, something like
echo '^[^Hello world^[\' (where ^[ is an escape)

can be used to display a message line.

When the `NF' capability is found in the termcap entry of the terminal on which screen has been started, flow control is turned off for the terminal. This enables the user to send XON and XOFF characters to the program running in a window (this is required by the emacs editor, for instance). The command line options -n and -f can be used to turn flow control off or on, respectively, independently of the `NF' capability.

Screen never writes in the last position of the screen, unless the boolean capability `LP' is found in the termcap entry of the terminal. Usually, screen cannot predict whether or not a particular terminal scrolls when a character is written in the last column of the last line; `LP' indicates that it is safe to write in this position. Note that the `LP' capability is independent of `am' (automatic margins); for certain terminals, such as the VT100, it is reasonable to set `am' as well as `LP' in the corresponding termcap entry (the VT100 does not move the cursor when a character is written in the last column of each line).

Screen puts into the environment of each process started in a newly created window the symbols "WINDOW=n" (where n is the number of the respective window), "TERM=screen", and a TERMCAP variable reflecting the capabilities of the virtual terminal emulated by screen. 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 standout mode, screen does not put the `so' and `se' 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 overstrike).

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. If screen is called with the -a option, all capabilities are put into the environment, even if screen must redraw parts of the display in order to implement a function.

The following is a list of control sequences recognized by screen. "(V)" and "(A)" indicate VT100-specific and ANSI-specific functions, respectively.

ESC E
Next Line
ESC D
Index
ESC M
Reverse Index
ESC H
Horizontal Tab Set
ESC 7
(V) Save Cursor and attributes
ESC 8
(V) 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 (Message Line)
ESC P
(A) Device Control String (not used)
ESC _
(A) Application Program Command (not used)
ESC ]
(A) Operating System Command (not used)
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: Italicised)
4
Underlined
5
Blinking
7
Negative Image
22
(A) Normal Intensity
23
(A) Standout Mode off (ANSI: Italicised 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
?5
(V) Visible Bell (On followed by Off)
?6
(V) Origin Mode
?7
(V) Wrap Mode
 

FILES

$(HOME)/.screenrc   screen initialization commands

$(HOME)/.screen Directory created by screen
$(HOME)/.screen/tty Socket created by screen
hardcopy.[0-9] Screen images created by the hardcopy function
/etc/termcap Terminal capability data base
/etc/utmp Login records
/etc/ttys Terminal initialization data
 

SEE ALSO

termcap(5), utmp(5)  

AUTHOR

Oliver Laumann  

BUGS

Standout mode is not cleared before newline or cursor addressing.

If `LP' is not set but `am' is set, the last character in the last line is never written, and it is not correctly re-displayed when the screen is scrolled up or when a character is deleted in the last line.

The VT100 "wrap around with cursor addressing" bug is not compensated when screen is running on a VT100.

`AL,' `DL', and similar parameterized capabilities are not used if present.

`dm' (delete mode), `xn', and `xs' are not handled correctly (they are ignored).

Different character sets are not supported.

`ms' is not advertised in the termcap entry (in order to compensate a bug in curses(3X)).

Scrolling regions are only emulated if the physical terminal supports scrolling regions.

Screen does not make use of hardware tabs.

Screen must be installed as set-uid with owner root in order to be able to correctly change the owner of the tty device file for each window. Special permission may also be required to write the file "/etc/utmp".

Entries in "/etc/utmp" are not removed when screen is killed with SIGKILL.


 

Index

NAME
SYNOPSIS
DESCRIPTION
COMMAND KEYS
CUSTOMIZATION
VIRTUAL TERMINAL
FILES
SEE ALSO
AUTHOR
BUGS

This document was created by man2html, using the manual pages.
Time: 21:50:19 GMT, February 02, 2023