screen [ -options ] [ cmd [ args ] ]
screen -r [[pid.]tty[.host]]
screen -r sessionowner/[[pid.]tty[.host]]
Examples:
screen -L /dev/tty.usbserial-FTFO9AFU 57600 # with screen.log.0 screen -L -h 500 /dev/tty.SLAB_USBtoUART 115200 # with scroll back ( ^a[ ) history 500 lines
Documentation tersified by DGerman.
Historial note: screen
was written for use with a serial port,
before X windows, MS Windows or other graphical window managers provided multi-process user interfaces. Much of the functionality provided by screen
,
is now available by opening multiple windows in a GUIs.
This document omitts some of the features that were previously very innovativate and important.
Full-screen text window manager that multiplexes a terminal between several
processes (typically interactive shells).
Each virtual terminal provides the functions of a VT100.
There is a scrollback history buffer for each virtual terminal and
a copy-and-paste mechanism that allows moving text regions between windows.
When called, it creates a window with a shell.
Commands, prefixed with a command-character, permit :
Keystrokes are sent to the program running in the current window.
Commands begin with control-a (abbreviated ^a
), and is followed by another keystroke.
To create a new window type ^a c
which starts a shell and switches to that window,
regardless of the state of the process running in the current window.
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 ^a :
command line) and then using it just like the ^a c
. 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 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.
Enter:
^a ?
to display list of commands
-L |
escapchar
defaulted to ^a
followed by one other character. ^a^t
for time
(except ^a a
),^A
below is only for clarity and should not be entered
^a ^\quit | Kill all windows and terminate.
| ^a ? | help | Show key bindings. i.e. these lines
| ^a r | wrap | Toggle line-wrap
| ^a W | width | Toggle 80/132 columns.
| ^a t | time | Show system information. For example: | 15:36:12 Aug 05 smacpro 1.64 1.82 1.76 from uptime
|
screen executes initialization commands from the files
/usr/local/etc/screenrc
and ~/.screenrc
.
$SYSSCREENRC
(may be disabled at compile-time).
.$SCREENRC
, then
$HOME/.screenrc
-c
(config file) takes precedence over the above user screenrc files.
These commands set options, bind functions to keys, and to automatically establish one or more
windows at the beginning of your screen session.
Commands are one per line, empty lines are ignored.
A command's arguments are separated by tabs or spaces, and may be surrounded by single or double quotes.
#
rest of the line is a comment, except in quotes.
Commands may contain references to environment variables. The syntax is the shelllike $VAR
or ${VAR}
.
Configuration files are included as examples:
etc/screenrc
and etc/etcscreenrc
Customization can also be done 'on-line'. To enter the command mode type ^a :
.
Commands starting with def
change default values, while others change current settings.
activity message
When any activity occurs in a background window that is being monitored, screen displays a
notification in the message line. | % in message is replaced by the number of the
window in which activity has occurred, ^G is replaced by the definition for bell in your termcap (usually an audible bell). Monitoring is off for all windows by default, use "monitor" command ^a M to enable.Default: Activity in window %n allpartial on|off |
| on : only the current cursor line is refreshed on window changeAffects 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. Does not change the default redraw behavior of newly created windows. altscreen on|off | | on : "alternate screen" support is enabled in virtual terminals, just like in
xterm. Initially off .
at [id][#|*|%] command [args … ]
Execute a command at other displays or windows as if it had been entered there. | "At" changes the context (the `current window' or `current display' setting) of the command.
If
Omitting
On the affected display(s) a short message will describe what happened.
Caveat: When matching against windows, the command is executed at least once per window.
attrcolor attrib [attribute/color-modifier]
|
Highlight attributes by changing the color of the text. | If the attribute attrib is in use, the specified attribute/color modifier is also applied. If no modifier is given, the current one is deleted. See STRING ESCAPES for the syntax of the modifier.
Two pseudo-attributes are used, " Examples:
autodetach on|off |
| on : automatically detach upon hangup, saves running programs until they resumed with a -r .off : hangup signal will terminate screen and all the processes it contains. Default:on autonuke on|off | clear screen sequence "nuke", purge buffers
| backtick id lifespan autorefresh cmd args … | backtick id Program the backtick command with the numerical | id .The output of such a command is used for substitution of the "%`" string escape. lifespan seconds the output is considered valid. After this time, the command is run again if a corresponding
string escape is encountered.
autorefresh triggers an automatic refresh for caption and hardstatus strings after the specified number of seconds.
The bce [on|off] | def bce on|off background-color-erase | on : all characters cleared by an erase/insert/scroll/clear operation will be displayed in the current background color. off the default background color is used.
bell_msg [msg] |
When a bell character is sent to a background window, displays a notification in the message line. | % replaced by the number of the window to which a bell has been sent, and
each occurrence of `^G' is replaced by the definition for bell in termcap (usually an audible bell). Default:Bell in window %n An empty message suppresses the message line ( bell_msg "" ). Without parameter, the current message is shown. bind [-c class] key [command [args]]
|
Bind a command to a key. | key is either a single character,
a two-character sequence of the form "^x" (meaning "^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 "\\".With no command previous binding is removed.
If a command examples: bind ' ' windows bind ^k bind k bind K kill bind ^f screen telnet foobar bind \033† screen -ln -t root -h 1000 9 suBinds the space key to the command that displays a list of windows in addition to a ^w" The next three lines remove the default kill binding for "^a ^k" and "^a k".Then binds "^a K" to the kill command (making it more ackward.). Then it binds "^f" to the command "create a window with a TELNET connection to foobar", and bind "escape" to the command that creates an non-login window with a.k.a. "root" in slot #9, with a superuser shell and a scrollback buffer of 1000 lines. bindkey "^B" command -c demo1bind -c demo1 0 select 10 bind -c demo1 1 select 11 bind -c demo1 2 select 12 binds "^b 0" select window 10, "^b 1" window 11, etc. bind -c demo2 0 select 10 bind -c demo2 1 select 11 bind -c demo2 2 select 12 bind - command -c demo2Binds "^a - 0" select window 10, "^a - 1" window 11, etc. bindkey [-d] [-m] [-a] [[-k|-t] string [cmd args]] |
manages input translation tables. | Entries in one of the tables tells screen how to react if a certain sequence of characters is encountered. There are three tables:
-d modifies the default table, -m changes the copy mode table and with neither option the user table is selected.
Examples : bindkey -d Make the "F1" key switch to window one. bindkey -k k1 select 1 Make "foo" an abbreviation of the word "barfoo". Timeout is disabled so that users can type slowly bindkey -t foo stuff barfooMakes "^T" an escape character for key-bindings. If you did the above "stuff barfoo" binding, you can enter the word "foo" by typing "^Tfoo". If you want to insert a "^T" you have to press the key twice (i.e. escape the escape binding). bindkey "\024" mapdefault
Make the F11 (not F1!) key an alternative screen escape (in addition to bindkey -k F1 command break [duration] | Send a break signal for | duration *0.25 seconds to this window. For non-Posix systems the
time interval may be rounded up to full seconds. Most useful if a character device is
attached to the window rather than a shell process (See also chapter "WINDOW TYPES"). The
maximum duration of a break signal is limited to 15 seconds.
breaktype [tcsendbreak|TIOCSBRK |TCSBRK] | current window only. still behaves identical to "defbreaktype". | with no parameter displays the break method for the current window. blanker | Activate the screen blanker. First the screen is cleared. If no blanker program is defined,
the cursor is turned off, otherwise, the program is started and it's output is written to
the screen. The screen blanker is killed with the first keypress, the read key is discarded.
This command is normally used together with the "idle" command.
| blankerprg [program argsi] | Defines a blanker program. Disables the blanker program if no arguments are given.
| bufferfile [exchange-file] | Change the filename used for reading and writing with the paste buffer. If the optional
argument to the "bufferfile" command is omitted, the default setting ("/tmp/screenexchange") is reactivated. The following example will paste the system's password file into
the screen window (using the paste buffer, where a copy remains):
| ^a : bufferfile /etc/passwd c1 [on|off]
|
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.
| caption always|splitonly [string]
caption string [string]
|
This command controls the display of the window captions. Normally a caption is only used if
more than one window is shown on the display (split screen mode). But if the type is set to
always screen shows a caption even if only one window is displayed. The default is splitonly.
The second form changes the text used for the caption. You can use all escapes from the
"STRING ESCAPES" chapter. Screen uses a default of `%3n %t'.
You can mix both forms by providing a string as an additional argument.
| charset set
|
Change the current character set slot designation and charset mapping. The first four character of set are treated as charset designators while the fifth and sixth character must be
in range '0' to '3' and set the GL/GR charset mapping. On every position a '.' may be used
to indicate that the corresponding charset/mapping should not be changed (set is padded to
six characters internally by appending '.' chars). New windows have "BBBB02" as default
charset, unless a "encoding" command is active.
The current setting can be viewed with the "info" command.
| chdir [directory]
|
Change the current directory of screen to the specified directory or, if called without an
argument, to your home directory (the value of the environment variable $HOME). All windows
that are created by means of the "screen" command from within ".screenrc" or by means of "^
a : screen ..." or "^a c" use this as their default directory. Without a chdir command,
this would be the directory from which screen was invoked. Hardcopy and log files are
always written to the window's default directory, not the current directory of the process
running in the window. You can use this command multiple times in your .screenrc to start
various windows in different default directories, but the last chdir value will affect all
the windows you create interactively.
| clear
|
Clears the current window and saves its image to the scrollback buffer.
| colon [prefix]
|
Allows you to enter ".screenrc" command lines. Useful for on-the-fly modification of key
bindings, specific window creation and changing settings. Note that the "set" keyword no
longer exists! Usually commands affect the current window rather than default settings for
future windows. Change defaults with commands starting with 'def...'.
If you consider this as the `Ex command mode' of screen, you may regard "^a esc" (copy
mode) as its `Vi command mode'.
| command [-c class]
|
This command has the same effect as typing the screen escape character (^A). It is probably
only useful for key bindings. If the "-c" option is given, select the specified command
class. See also "bind" and "bindkey".
| compacthist [on|off] | suppress trailing blank lines when scrolling up text into the history buffer.
| console [on|off] | Grabs or un-grabs the machines console output to a window. Note: Only the owner of
/dev/console can grab the console output. This command is only available if the machine
supports the ioctl TIOCCONS.
| copy |
Enter copy/scrollback mode. copy text from the current window and its
history into the paste buffer. In this mode a vi-like `full screen editor' is active:
Movement keys:
|
copy_reg [key] | No longer exists, use "readreg" instead.
| crlf [on|off] | affects the copying of text regions with | ^a [ . on lines will be separated by the two character sequence `CR' - `LF'. Otherwise (default) only `LF' is used. When no parameter is given, the state is toggled. debug on|off | if compiled with option -DDEBUG debugging
available and is turned on per default. Note that this command only affects debugging output
from the main "SCREEN" process correctly. Debug output from attacher processes can only be turned off once and forever.
| detach [-h] | Detach the screen session (disconnect it from the terminal and put it into the background). | Returns you to the shell where you invoked screen. A detached screen can be resumed by invoking screen with -r (see also section "COMMAND-LINE OPTIONS"). The -h option
tells screen to immediately close the connection to the terminal ("hangup").
dinfo | Useful if you want to know why features like color or the alternate charset don't work.
| displays | Shows a tabular listing of all currently connected user front-ends (displays). useful for multiuser sessions.
| digraph [preset] | prompts for a digraph sequence. | The next two characters typed are looked up in a builtin table and the resulting character is inserted in the input stream. For example, enter 'a"', an a-umlaut will be inserted. A 0 leadin prefixes up to three as an octal digits . The optional argument preset is treated as user input, thus one can create an "umlaut" key. For example the command "bindkey ^K digraph '"'" enables the user to generate an a-umlaut by typing CTRL-K a. dumptermcap | dump termcap entry for the virtual terminal optimized for the currently active window
to the | .termcap" in $HOME/.screen (or wherever screen stores
its sockets. See the "FILES" section below). 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.
echo [-n] message | a 'message of the day'. Typically
installed in a global /local/etc/screenrc. The option "-n" may be used to suppress the line
feed. See also "sleep". Echo is also useful for online checking of environment variables.
| encoding enc [enc]
| interpret the input/output. The first argument sets the encoding of the current window. Each window can emulate a different encoding. The optional second parameter
overwrites the encoding of the connected terminal. It should never be needed as screen uses
the locale setting to detect the encoding. There is also a way to select a terminal encoding depending on the terminal type by using the "KJ" termcap entry.
Supported encodings are | eucJP, SJIS, eucKR, eucCN, Big5, GBK, KOI8-R, CP1251, UTF-8,
ISO8859-2, ISO8859-3, ISO8859-4, ISO8859-5, ISO8859-6, ISO8859-7, ISO8859-8, ISO8859-9,
ISO8859-10, ISO8859-15, jis.
See also "defencoding", which changes the default setting of a new window.
escape xy | Set the command character to x and the character generating a literal command character (by
triggering the "meta" command) to y (similar to the -e option). Each argument is either a
single character, a two-character sequence of the form "^x" (meaning "^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".
| eval command1 [command2 ...] | Parses and executes each argument as separate command.
| exec [[fdpat] newcommand [args ...]] |
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 originally started in the window (let us call it "application-process") 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 application-process. A colon (:) combines both. User input will go to newcommand unless newcommand receives the application-process' output (fdpats first character is `!' or `:') or a pipe symbol (|) is added (as a fourth character) to the end of fdpat. Invoking exec without arguments shows name and arguments of the currently running subprocess in this window. Only one subprocess a time can be running in each 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 a confusing illustration of all 21 possible
combinations. Each drawing shows the digits 2,1,0 representing the three file descriptors of
newcommand. The box marked `W' is the usual pty that has the application-process on its slave side. The box marked `P' is the secondary pty that now has screen at its master side.
Abbreviations:
Whitespace between the word `exec' and fdpat and the command can be omitted. exec ... /bin/sh exec /bin/sh !/bin/shCreates another shell in the same window, while the original shell is still running. Output of both shells is displayed and user input is sent to the new /bin/sh. exec !.. stty 19200 exec ! stty 19200 !!stty 19200Set the speed of the window's tty. If your stty command operates on stdout, then add another `!'. exec !..| less |lessThis 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 window's process. This works,
because less listens on stderr (a behavior that screen would not expect without the `|')
when its stdin is not a tty. Less versions newer than 177 fail miserably here; good old pg
still works.
!:sed -n s/.*Error.*/\007/pSends 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. fit | Change the window size to the size of the current region. This command is needed because
screen doesn't adapt the window size automatically if the window is displayed more than once.
| flow [on|off|auto]
|
Sets the flow-control mode for this window. Without parameters it cycles the current window's flow-control setting from "automatic" to "on" to "off". See the discussion on "FLOWCONTROL" later on in this document for full details and note, that this is subject to change
in future releases. Default is set by `defflow'.
| focus [up|down|top|bottom]
|
Move the input focus to the next region. This is done in a cyclic way so that the top region
is selected after the bottom one. If no subcommand is given it defaults to `down'. `up'
cycles in the opposite order, `top' and `bottom' go to the top and bottom region respectively. Useful bindings are (j and k as in vi)
| bind j focus down bind k focus up bind t focus top bind b focus bottom gr [on|off] | character with the 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. hardcopy [-h] [file] |
Writes out the currently displayed image to the | file , default: hardcopy.n
in the default directory, where n is the number of the current window. appends or overwrites the file if it exists. See below. If the option -h is specified, dump also the contents of the scrollback buffer. hardcopy_append on|off | append to the "hardcopy.n" files created by the command "^a h" . Default is `off'.
| hardcopydir directory |
| hardstatus [on|off] | hardstatus [always]lastline|message|ignore [string] hardstatus string [string]
configures the use and emulation of the terminal's hardstatus line. | The first form toggles whether screen will use the hardware status line to display messages. If the flag is set to `off', these messages are overlaid in reverse video mode at the display line. The default setting is `on'. The second form tells screen what to do if the terminal doesn't have a hardstatus line (i.e. the termcap/terminfo capabilities "hs", "ts", "fs" and "ds" are not set). If the type "lastline" is used, screen will reserve the last line of the display for the hardstatus. "message" uses screen's message mechanism and "ignore" tells screen never to display the hardstatus. If you prepend the word "always" to the type (e.g., "alwayslastline"), screen will use the type even if the terminal supports a hardstatus.
The third form specifies the contents of the hardstatus line. '%h' is used as default
string, i.e. the stored hardstatus of the current window (settable via "ESC]0;
You can mix the second and third form by providing the string as additional argument.
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 is shown. If the window is in
UTF-8 mode, the string "UTF-8" is shown instead.
Additional modes depending on the type of the window are displayed at the end of the status
line (See also chapter "WINDOW TYPES").
If the state machine of the terminal emulator is in a non-default state, the info line is
started with a string identifying the current state.
For system information use the "time" command.
Note that termcap/terminfo/termcapinfo commands only work at startup and reattach time, so
they must be reached via the default screenrc files to have an effect.
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 (see the "VIRTUAL TERMINAL" section).
Some examples:
If you would like to fully specify each window's termcap entry, you should instead set the
$SCREENCAP variable prior to running screen. See the discussion on the "VIRTUAL TERMINAL"
in this manual, and the termcap(5) man page for more information on termcap definitions.
If a string is specified, it changes the format of the time report like it is described in
the "STRING ESCAPES" chapter. Screen uses a default of "%c:%s %M %d %H%? %l%?".
The table format can be changed with the string and title option, the title is displayed as
table heading, while the lines are made by using the string setting. The default setting is
"Num Name%=Flags" for the title and "%3n %t%=%f" for the lines. See the "STRING ESCAPES"
chapter for more codes (e.g. color settings).
|
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 '␛^Hello world from window '$WINDOW'␛\\'where ␛ is an escape,
^
is a literal up-arrow, and \\
turns into a single backslash.
baud_rate |
For tty windows, the info command shows some of the modem control lines in the status line. These may include `RTS', `CTS', 'DTR', `DSR', `CD' and more. This depends on the available ioctl()'s and system header files as well as the on the physical capabilities of the serial board. Signals that are logical low (inactive) have their name preceded by an exclamation mark (!), otherwise the signal is logical high (active). Signals not supported by the hardware but available to the ioctl() interface are usually shown low. When the CLOCAL status bit is true, the whole set of modem signals is placed inside curly braces ({ and }). When the CRTSCTS or TIOCSOFTCAR bit is set, the signals `CTS' or `CD' are shown in parenthesis, respectively.
For tty windows, break
causes the Data transmission line (TxD) to go low for
a specified period of time. This is interpreted as the break signal
. No data is sent and no modem control line is change.d
b BINARY. The connection is in binary mode. e ECHO. Local echo is disabled. c SGA. The connection is in `character mode' (default: `line mode'). t TTYPE. The terminal type has been requested by the remote host. Screen sends the name "screen" unless instructed otherwise (see also the command `term'). w NAWS. The remote site is notified about window size changes. f LFLOW. The remote host will send flow control information. (Ignored at the moment.)Additional flags for debugging are x, t and n (XDISPLOC, TSPEED and NEWENV).
For telnet windows, the command break sends the telnet code IAC BREAK (decimal 243) to the remote host.
This window type is only available if screen was compiled with the BUILTIN_TELNET option defined.
% |
Examples: "G" set color to bright green "+b r" use bold red "= yd" clear all attributes, write in default color on yellow background. %-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%< The available windows centered at the current window and truncated to the available width. The current window is displayed white on blue. This can be used with "hardzzz status alwayslastline". %?%F%{.R.}%?%3n %t%? [%h]%? The window number and title and the window's hardstatus, if one is set. Also use a red background if this is the active focus. Useful for "caption string".
Each window has an initial flow-control value set with either the -f option or the "defflow" .screenrc command. Per 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 "^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 find out 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) 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 "^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 it is possible to interrupt the output of the virtual terminal to your physical terminal when flow-control is enabled. If this happens, a simple refresh of the screen with "^a l" will restore it. Give each mode a try, and use whichever mode you find more comfortable.
The default name for all shell windows can be set with the "shelltitle" command in the .screenrc file, while all other windows are created with a "screen" command and thus can have their name set with the -t option. Interactively, there is the title-string escapesequence (␛kname␛\) and the "title" command (^a A). The former can be output from an application to control the window's name under software control, and the latter will prompt for a name when typed. You can also bind pre-defined names to keys with the "title" command to set things quickly without prompting.
screen has a shell-specific heuristic that is enabled by setting the window's name to "search|name" and arranging to have a null title escape-sequence output as a part of your prompt. The search portion specifies an end-of-prompt search string, while the name portion specifies the default shell name for the window. If the name ends in a `:' screen will add what it believes to be the current command running in the window to the end of the window's shell name (e.g. "name:cmd"). Otherwise the current command name supersedes the shell name while it is running.
you must modify your shell prompt to output a null title-escapesequence (␛k␛\) as a part of your prompt. The last part of your prompt must be the same as the string you specified for the search portion of the title. Once this is set up, screen will use the title-escape-sequence to clear the previous command name and get ready for the next command. Then, when a newline is received from the shell, a search is made for the end of the prompt. If found, it will grab the first word after the matched string and use it as the command name. If the command name begins with either '!', '%', or '^' screen will use the first word on the following line (if found) in preference to the just-found name. This helps csh users get better command names when using job control or history recall commands.
Here's some .screenrc examples:
screen -t top 2 nice topAdding this line to your .screenrc would start a nice-d version of the "top" command in window 2 named "top" rather than "nice".
shelltitle '> |csh'These commands would start a shell with 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:
screen 1
/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:' suHaving this command in your .screenrc would bind the key sequence "^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:
% !ememacs 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 # prompts for a title. Enter ^a o
.
bind E title "" # clears auto-title's current setting (^a E).
bind u title (unknown) # set the current window's title to "(unknown)" (^a u).
Some shells (like csh) count all the non-control characters as part of the prompt's
length including a null title-escape-sequence.
If invisible characters aren't a multiple of 8 backspacing over a tab
will result in an incorrect display. One way to get around this is to use a prompt like this:
set prompt='^[[0000m^[k^[\% 'The escape-sequence "␛[0000m" normalizes the character attributes and all the zeros round the length of the invisible characters up to 8. Bash users should echo the escape sequence in the PROMPT_COMMAND:
PROMPT_COMMAND='echo -n -e "\033k\033\134"'
With rlogin 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:
Screen determines a terminal name by 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 is 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.
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 use the VT100 graphics character set or national character sets. These 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.
A list of control sequences recognized by screen. "(V)" and "(A)" indicate VT100-specific and ANSI- or ISO-specific functions, respectively.
Here is the table of the default key bindings. (A) means that the command is executed if the keyboard is switched into application mode.
/etc/termcap
) or use them with the commands termcap
, terminfo
and termcapinfo
in
your screenrc files. It is often not possible to place these capabilities in the terminfo
database.
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). |
.../screen-4.?.??/etc/screenrc
.../screen-4.?.??/etc/etcscreenrc
Examples in the screen distribution package for private $SYSSCREENRC
/usr/local/etc/screenrc
screen initialization commands $SCREENRC
$HOME/.screenrc
Read in after /usr/local/etc/screenrc $SCREENDIR/S-
/local/screens/S-
Socket directories (default) /usr/tmp/screens/S-
Alternate socket directories. /.termcap
Written by the "termcap" output function /usr/tmp/screens/screen-exchange
or /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/?/*
or /etc/termcap
Terminal capability databases /etc/utmp
Login records $LOCKPRG
Program that locks a terminal.
CONTRIBUTORS Ken Beal (kbeal@amber.ssd.csd.harris.com), Rudolf Koenig (rfkoenig@immd4.informatik.uni-erlangen.de), Toerless Eckert (eckert@immd4.informatik.uni-erlangen.de), Wayne Davison (davison@borland.com), Patrick Wolfe (pat@kai.com, kailand!pat), Bart Schaefer (schaefer@cse.ogi.edu), Nathan Glasser (nathan@brokaw.lcs.mit.edu), Larry W. Virden (lvirden@cas.org), Howard Chu (hyc@hanauma.jpl.nasa.gov), Tim MacKenzie (tym@dibbler.cs.monash.edu.au), Markku Jarvinen (mta@{cc,cs,ee}.tut.fi), Marc Boucher (marc@CAM.ORG), Doug Siebert (dsiebert@isca.uiowa.edu), Ken Stillson (stillson@tsfsrv.mitre.org), Ian Frechett (frechett@spot.Colorado.EDU), Brian Koehmstedt (bpk@gnu.ai.mit.edu), Don Smith (djs6015@ultb.isc.rit.edu), Frank van der Linden (vdlinden@fwi.uva.nl), Martin Schweikert (schweik@cpp.ob.open.de), David Vrona (dave@sashimi.lcu.com), E. Tye McQueen (tye%spillman.UUCP@uunet.uu.net), Matthew Green (mrg@eterna.com.au), Christopher Williams (cgw@pobox.com), Matt Mosley (mattm@access.digex.net), Gregory Neil Shapiro (gshapiro@wpi.WPI.EDU), Johannes Zellner (johannes@zellner.org), Pablo Averbuj (pablo@averbuj.com).
/etc/utmp
/etc/utmp
are not removed when screen is killed with SIGKILL causing some programs (like "w" or "rwho") to advertise that a user is logged on who really isn't.
-D
or -d
-D
or -d
detach a session without asking.
.screenrc
is not sourced. Each user's personal settings have to be included in the .screenrc file from which the session is booted, or have to be changed manually.
etc/utmp
is writable by screen, a record will be written for
each window, and removed when the window is terminated. This is for working with
"talk", "script", "shutdown", "rsend", "sccs" and similar programs that use utmp
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 ^a L
.
setuid-root
, the user can specify any mode 700 directory in the environment variable $SCREENDIR
.
The "socket directory" defaults to $HOME/.screen
or /tmp/screens
or /usr/local/screens
chosen at compile-time.
If screen is installed setuid-root
, the administrator should compile screen with an adequate (not NFS mounted) socket directory.
4th Berkeley Distribution Aug 2003 SCREEN(1)
-onlcr
to translate  to ␍