Table of Contents

This page (as well as the other pages in the man: namespace) is derived from the screen man page; please try not to deviate too much from its text.

If you want to add supplemental information, put it in a page in the main namespace and link to that page from here.

Name

screen - screen manager with VT100/ANSI terminal emulation

Synopsis

screen [ options ] [ cmd [ args ] ]
screen -r [[pid.]tty[.host]]
screen -r sessionowner/[[pid.]tty[.host]]

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 a DEC VT100 terminal and, in addition, several control functions from the ISO 6429 (ECMA 48, ANSI X3.64) and ISO 2022 standards (e.g. insert/delete line and support for multiple character sets). There is a scrollback history buffer for each virtual terminal and a copy-and-paste mechanism that allows moving text regions between windows.

When screen is called, it creates a single window with a shell in it (or the specified command) and then gets out of your way so that you can use the program as you normally would. Then, at any time, you can create new (full-screen) windows with other programs in them (including more shells), kill existing windows, view a list of windows, turn output logging on and off, copy-and-paste text between windows, view the scrollback history, switch between windows in whatever manner you wish, etc. All windows run their programs completely independent of each other. Programs continue to run when their window is currently not visible and even when the whole screen session is detached from the user's terminal. When a program terminates, screen (per default) kills the window that contained it. If this window was in the foreground, the display switches to the previous window; if none are left, screen exits.

Everything you type is sent to the program running in the current window. The only exception to this is the one keystroke that is used to initiate a command to the window manager. By default, each command begins with a control-a (abbreviated C-a from now on), and is followed by one other keystroke. The command character and all the key bindings can be fully customized to be anything you like, though they are always two characters in length.

screen does not understand the prefix “C-” to mean control. Please use the caret notation (“^A” instead of “C-a”) as arguments to e.g. the escape command or the -e option. Screen will also print out control characters in caret notation.

The standard way to create a new window is to type “C-a c”. This 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. Similarly, you can create a new window with a custom command in it by first binding the command to a keystroke (in your .screenrc file or at the “C-a :” command line) and then using it just like the “C-a c” command. In addition, new windows can be created by running a command like:

screen emacs prog.c

from a shell prompt within a previously created window. This will not run another copy of screen, but will instead supply the command name and its arguments to the window manager (specified in the $STY environment variable) who will use it to create the new window. The above example would start the emacs editor (editing prog.c) and switch to its window. Note that you cannot transport environment variables from the invoking shell to the application (emacs in this case), because it is forked from the parent screen process, not from the invoking shell.

If “/var/run/utmp” is writable by screen, an appropriate record will be written to this file for each window, and removed when the window is terminated. This is useful for working with “talk”, “script”, “shutdown”, “rsend”, “sccs” and other similar programs that use the utmp file to determine who you are. As long as screen is active on your terminal, the terminal's own record is removed from the utmp file. See also “C-a L”.

Getting Started

Before you begin to use screen you'll need to make sure you have correctly selected your terminal type, just as you would for any other termcap/terminfo program. (You can do this by using tset for example.)

If you're impatient and want to get started without doing a lot more reading, you should remember this one command: “C-a ?”. Typing these two characters will display a list of the available screen commands and their bindings. Each keystroke is discussed in the section “Default Key Bindings”. The manual section “Customization” deals with the contents of your .screenrc.

If your terminal is a “true” auto-margin terminal (it doesn't allow the last position on the screen to be updated without scrolling the screen) consider using a version of your terminal's termcap that has automatic margins turned off. This will ensure an accurate and optimal update of the screen in all circumstances. Most terminals nowadays have “magic” margins (automatic margins plus usable last column). This is the VT100 style type and perfectly suited for screen. If all you've got is a “true” auto-margin terminal screen will be content to use it, but updating a character put into the last position on the screen may not be possible until the screen scrolls or the character is moved into a safe position in some other way. This delay can be shortened by using a terminal with insert-character capability.

Command-Line Options

See Command-Line Options.

Default Key Bindings

See Default Key Bindings.

Customization

See Customization.

The Message Line

screen displays informational messages and other diagnostics in a message line. While this line is distributed to appear at the bottom of the screen, it can be defined to appear at the top of the screen during compilation. If your terminal has a status line defined in its termcap, screen will use this for displaying its messages, otherwise a line of the current screen will be temporarily overwritten and output will be momentarily interrupted. The message line is automatically removed after a few seconds delay, but it can also be removed early (on terminals without a status line) by beginning to type.

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, try something like:

echo '<esc>^Hello world from window '$WINDOW'<esc>\\'

where <esc> is an escape, ^ is a literal up-arrow, and \\ turns into a single backslash.

Window Types

See Window Types.

String Escapes

See String Escapes.

Flow-Control

See Flow-Control.

Session Name (naming sessions)

See sessionnames

Titles (naming windows)

See Titles.

The Virtual Terminal

See The Virtual Terminal.

Input Translation

See Input Translation.

Special Terminal Capabilities

See Special Terminal Capabilities.

Character Translation

See Character Translation.

Environment

COLUMNS
Number of columns on the terminal (overrides termcap entry).
HOME
Directory in which to look for .screenrc.
LINES
Number of lines on the terminal (overrides termcap entry).
LOCKPRG
Screen lock program.
NETHACKOPTIONS
Turns on nethack option.
PATH
Used for locating programs to run.
SCREENCAP
For customizing a terminal's TERMCAP value.
SCREENDIR
Alternate socket directory.
SCREENRC
Alternate user screenrc file.
SHELL
Default shell program for opening windows (default “/bin/sh”).
STY
Alternate socket name.
SYSSCREENRC
Alternate system screenrc file.
TERM
Terminal name.
TERMCAP
Terminal description.
WINDOW
Window number of a window (at creation time).

Files

$SYSSCREENRC
/etc/screenrc
screen initialization commands
$SCREENRC
$HOME/.screenrc
Read in after /etc/screenrc
$SCREENDIR/S-<login>
/var/run/screen/S-<login>
Socket directories (default)
/usr/tmp/screens/S-<login> Alternate socket directories.
<socket directory>/.termcap Written by the termcap output function
/usr/tmp/screens/screen-exchange
/tmp/screen-exchange
screen 'interprocess communication buffer'
hardcopy.[0-9] Screen images created by the hardcopy function
screenlog.[0-9] Output log files created by the log function
/usr/lib/terminfo/?/*
/etc/termcap
Terminal capability databases
/var/run/utmp Login records
$LOCKPRG Program that locks a terminal.

See Also

termcap(5), utmp(5), vi(1), captoinfo(1), tic(1)

Authors

Originally created by Oliver Laumann, this latest version was produced by Wayne Davison, Juergen Weigert and Michael Schroeder.

Copyleft

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program (see the file COPYING); if not, write to the Free Software Foundation, Inc., 59 Temple Place Suite 330, Boston, MA 02111-1307, USA

Contributors

Version

This is version 4.0.2. Its roots are a merge of a custom version 2.3PR7 by Wayne Davison and several enhancements to Oliver Laumann's version 2.0. Note that all versions numbered 2.x are copyright by Oliver Laumann.

Availability

The latest official release of screen available via anonymous ftp from ftp://gnudist.gnu.org, ftp://nic.funet.fi or any other GNU distribution site. The home site of screen is ftp://ftp.uni-erlangen.de, in the directory pub/utilities/screen. The subdirectory `private' contains the latest beta testing release. If you want to help, send a note to screen@uni-erlangen.de.

Bugs