This file documents the 'Screen' virtual terminal manager.

   Copyright (c) 1993-2003 Free Software Foundation, Inc.

   Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.

   Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.

   Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be stated in a
translation approved by the Foundation.

6.5 Term
========

 -- Command: term term
     (none)
     In each window 'screen' opens, it sets the '$TERM' variable to
     'screen' by default, unless no description for 'screen' is
     installed in the local termcap or terminfo data base.  In that case
     it pretends that the terminal emulator is 'vt100'.  This won't do
     much harm, as 'screen' is VT100/ANSI compatible.  The use of the
     'term' command is discouraged for non-default purpose.  That is,
     one may want to specify special '$TERM' settings (e.g.  vt100) for
     the next 'screen rlogin othermachine' command.  Use the command
     'screen -T vt100 rlogin othermachine' rather than setting and
     resetting the default.

6.6 Window Types
================

Screen provides three different window types.  New windows are created
with 'screen''s 'screen' command (see Screen Command).  The first
parameter to the 'screen' command defines which type of window is
created.  The different window types are all special cases of the normal
type.  They have been added in order to allow 'screen' to be used
efficiently as a console with 100 or more windows.
   * The normal window contains a shell (default, if no parameter is
     given) or any other system command that could be executed from a
     shell.  (e.g.  'slogin', etc...).

   * If a tty (character special device) name (e.g.  '/dev/ttya') is
     specified as the first parameter, then the window is directly
     connected to this device.  This window type is similar to 'screen
     cu -l /dev/ttya'.  Read and write access is required on the device
     node, an exclusive open is attempted on the node to mark the
     connection line as busy.  An optional parameter is allowed
     consisting of a comma separated list of flags in the notation used
     by 'stty(1)':
     '<baud_rate>'
          Usually 300, 1200, 9600 or 19200.  This affects transmission
          as well as receive speed.
     'cs8 or cs7'
          Specify the transmission of eight (or seven) bits per byte.
     'ixon or -ixon'
          Enables (or disables) software flow-control (CTRL-S/CTRL-Q)
          for sending data.
     'ixoff or -ixoff'
          Enables (or disables) software flow-control for receiving
          data.
     'istrip or -istrip'
          Clear (or keep) the eight bit in each received byte.

     You may want to specify as many of these options as applicable.
     Unspecified options cause the terminal driver to make up the
     parameter values of the connection.  These values are
     system-dependent and may be in defaults or values saved from a
     previous connection.

     For tty windows, the 'info' command shows some of the modem control
     lines in the status line.  These may include 'RTS', 'CTS', 'DTR',
     'CD' and more.  This depends rather on on the available 'ioctl()''s
     and system header files than on the physical capabilities of the
     serial board.  The name of a logical low (inactive) signal is
     preceded by an exclamation mark ('!'), otherwise the signal is
     logical high (active).  Unsupported but shown signals 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 true, the signals 'CTS' or
     'CD' are shown in parenthesis, respectively.

     For tty windows, the command 'break' causes the Data transmission
     line (TxD) to go low for a specified period of time.  This is
     expected to be interpreted as break signal on the other side.  No
     data is sent and no modem control line is changed when a 'break' is
     issued.

   * If the first parameter is '//telnet', the second parameter is
     expected to be a host name, and an optional third parameter may
     specify a TCP port number (default decimal 23).  Screen will
     connect to a server listening on the remote host and use the telnet
     protocol to communicate with that server.

     For telnet windows, the command 'info' shows details about the
     connection in square brackets ('[' and ']') at the end of the
     status line.
     '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.

6.7 Window Groups
=================

Screen provides a method for grouping windows together.  Windows can be
organized in a hierarchical fashion, resembling a tree structure.  New
screens are created using the 'screen' command while new groups are
created using 'screen //group'.  See Screen Command.

   Once a new group is created, it will act as a container for windows
and even other groups.  When a group is selected, you will see the
output of the 'windowlist' command, allowing you to select a window
inside.  If there are no windows inside a group, use the 'screen'
command to create one.  Once inside a group, using the commands 'next'
and 'prev' will switch between windows only in that group.  Using the
'windowlist' command will give you the opportunity to leave the group
you are in.  See Windowlist.

 -- Command: group [grouptitle]
     (none)
     Change or show the group the current window belongs to.  Windows
     can be moved around between different groups by specifying the name
     of the destination group.  Without specifying a group, the title of
     the current group is displayed.

   Using groups in combination with layouts will help create a
multi-desktop experience.  One group can be assigned for each layout
made.  Windows can be made, split, and organized within each group as
desired.  Afterwhich, switching between groups can be as easy as
switching layouts.

7 Selecting a Window
********************

This section describes the commands for switching between windows in an
'screen' session.  The windows are numbered from 0 to 9, and are created
in that order by default (see New Window).

7.1 Moving Back and Forth
=========================

 -- Command: next
     ('C-a <SPC>', 'C-a n', 'C-a C-n')
     Switch to the next window.  This command can be used repeatedly to
     cycle through the list of windows.  (On some terminals, C-<SPC>
     generates a NUL character, so you must release the control key
     before pressing space.)

 -- Command: prev
     ('C-a p', 'C-a C-p', 'C-a C-h', 'C-a <Backspace>')
     Switch to the previous window (the opposite of 'C-a n').

7.2 Other Window
================

 -- Command: other
     ('C-a C-a')
     Switch to the last window displayed.  Note that this command
     defaults to the command character typed twice, unless overridden.
     For instance, if you use the option '-e]x', this command becomes
     ']]' (see Command Character).

7.3 Select
==========

 -- Command: select [n |-|.]
     ('C-a N', 'C-a '')
     Switch to the window with the number N.  If no window number is
     specified, you get prompted for an identifier.  This can be a
     window name (title) or a number.  When a new window is established,
     the lowest available number is assigned to this window.  Thus, the
     first window can be activated by 'select 0'; there can be no more
     than 10 windows present simultaneously (unless screen is compiled
     with a higher MAXWIN setting).  There are two special arguments,
     'select -' switches to the internal blank window and 'select .'
     switches to the current window.  The latter is useful if used with
     screen's '-X' option.

7.4 Windowlist
==============

 -- Command: windowlist [-b] [-m] [-g]
 -- Command: windowlist string [STRING]
 -- Command: windowlist title [TITLE]
     ('C-a "')
     Display all windows in a table for visual window selection.  If
     screen was in a window group, screen will back out of the group and
     then display the windows in that group.  If the '-b' option is
     given, screen will switch to the blank window before presenting the
     list, so that the current window is also selectable.  The '-m'
     option changes the order of the windows, instead of sorting by
     window numbers screen uses its internal most-recently-used list.
     The '-g' option will show the windows inside any groups in that
     level and downwards.

     The following keys are used to navigate in 'windowlist':

     'k', 'C-p', or 'up' Move up one line.

     'j', 'C-n', or 'down' Move down one line.

     'C-g' or 'escape' Exit windowlist.

     'C-a' or 'home' Move to the first line.

     'C-e' or 'end' Move to the last line.

     'C-u' or 'C-d' Move one half page up or down.

     'C-b' or 'C-f' Move one full page up or down.

     '0..9' Using the number keys, move to the selected line.

     'mouseclick' Move to the selected line.  Available when
     'mousetrack' is set to 'on'.

     '/' Search.

     'n' Repeat search in the forward direction.

     'N' Repeat search in the backward direction.

     'm' Toggle MRU.

     'g' Toggle group nesting.

     'a' All window view.

     'C-h' or 'backspace' Back out the group.

     ',' Switch numbers with the previous window.

     '.' Switch numbers with the next window.

     'K' Kill that window.

     'space' or 'enter' Select that window.

     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 (see String Escapes) for more codes
     (e.g.  color settings).

     'Windowlist' needs a region size of at least 10 characters wide and
     6 characters high in order to display.

8 Session Management Commands
*****************************

Perhaps the most useful feature of 'screen' is the way it allows the
user to move a session between terminals, by detaching and reattaching.
This also makes life easier for modem users who have to deal with
unexpected loss of carrier.

8.1 Detach
==========

 -- Command: autodetach state
     (none)
     Sets whether 'screen' will automatically detach upon hangup, which
     saves all your running programs until they are resumed with a
     'screen -r' command.  When turned off, a hangup signal will
     terminate 'screen' and all the processes it contains.  Autodetach
     is on by default.

 -- Command: detach
     ('C-a d', 'C-a C-d')
     Detach the 'screen' session (disconnect it from the terminal and
     put it into the background).  A detached 'screen' can be resumed by
     invoking 'screen' with the '-r' option (see Invoking Screen).
     The '-h' option tells screen to immediately close the connection to
     the terminal ('hangup').

 -- Command: password [crypted_pw]
     (none)
     Present a crypted password in your '.screenrc' file and screen will
     ask for it, whenever someone attempts to resume a detached session.
     This is useful, if you have privileged programs running under
     'screen' and you want to protect your session from reattach
     attempts by users that managed to assume your uid.  (I.e.  any
     superuser.)  If no crypted password is specified, screen prompts
     twice a password and places its encryption in the paste buffer.
     Default is 'none', which disables password checking.

8.2 Power Detach
================

 -- Command: pow_detach
     ('C-a D D')
     Mainly the same as 'detach', but also sends a HANGUP signal to the
     parent process of 'screen'.
     _Caution_: This will result in a logout if 'screen' was started
     from your login-shell.

 -- Command: pow_detach_msg [message]
     (none)
     The MESSAGE specified here is output whenever a power detach is
     performed.  It may be used as a replacement for a logout message or
     to reset baud rate, etc.  Without a parameter, the current message
     is shown.

8.3 Lock
========

 -- Command: lockscreen
     ('C-a x', 'C-a C-x')
     Call a screenlock program ('/local/bin/lck' or '/usr/bin/lock' or a
     builtin, if no other is available).  Screen does not accept any
     command keys until this program terminates.  Meanwhile processes in
     the windows may continue, as the windows are in the detached state.
     The screenlock program may be changed through the environment
     variable '$LOCKPRG' (which must be set in the shell from which
     'screen' is started) and is executed with the user's uid and gid.

     Warning: When you leave other shells unlocked and have no password
     set on 'screen', the lock is void: One could easily re-attach from
     an unlocked shell.  This feature should rather be called
     'lockterminal'.

8.4 Multiuser Session
=====================

These commands allow other users to gain access to one single 'screen'
session.  When attaching to a multiuser 'screen' the sessionname is
specified as 'username/sessionname' to the '-S' command line option.
'Screen' must be compiled with multiuser support to enable features
described here.

8.4.1 Multiuser
---------------

 -- Command: multiuser STATE
     (none)
     Switch between single-user and multi-user mode.  Standard screen
     operation is single-user.  In multi-user mode the commands
     'acladd', 'aclchg' and 'acldel' can be used to enable (and disable)
     other users accessing this 'screen'.

8.4.2 Acladd
------------

 -- Command: acladd USERNAMES
 -- Command: addacl USERNAMES
     (none)
     Enable users to fully access this screen session.  USERNAMES can be
     one user or a comma separated list of users.  This command enables
     to attach to the 'screen' session and performs the equivalent of
     'aclchg USERNAMES +rwx "#?"'.  To add a user with restricted
     access, use the 'aclchg' command below.  'Addacl' is a synonym to
     'acladd'.  Multi-user mode only.

8.4.3 Aclchg
------------

 -- Command: aclchg USERNAMES PERMBITS LIST
 -- Command: chacl USERNAMES PERMBITS LIST
     (none)
     Change permissions for a comma separated list of users.  Permission
     bits are represented as 'r', 'w' and 'x'.  Prefixing '+' grants the
     permission, '-' removes it.  The third parameter is a comma
     separated list of commands or windows (specified either by number
     or title).  The special list '#' refers to all windows, '?' to all
     commands.  If USERNAMES consists of a single '*', all known users
     are affected.  A command can be executed when the user has the 'x'
     bit for it.  The user can type input to a window when he has its
     'w' bit set and no other user obtains a writelock for this window.
     Other bits are currently ignored.  To withdraw the writelock from
     another user in e.g.  window 2: 'aclchg USERNAME -w+w 2'.  To allow
     read-only access to the session: 'aclchg USERNAME -w "#"'.  As soon
     as a user's name is known to screen, he can attach to the session
     and (per default) has full permissions for all command and windows.
     Execution permission for the acl commands, 'at' and others should
     also be removed or the user may be able to regain write permission.
     'Chacl' is a synonym to 'aclchg'.  Multi-user mode only.

8.4.4 Acldel
------------

 -- Command: acldel USERNAME
     (none)
     Remove a user from screen's access control list.  If currently
     attached, all the user's displays are detached from the session.
     He cannot attach again.  Multi-user mode only.

8.4.5 Aclgrp
------------

 -- Command: aclgrp USERNAME [GROUPNAME]
     (none)
     Creates groups of users that share common access rights.  The name
     of the group is the username of the group leader.  Each member of
     the group inherits the permissions that are granted to the group
     leader.  That means, if a user fails an access check, another check
     is made for the group leader.  A user is removed from all groups
     the special value 'none' is used for GROUPNAME.  If the second
     parameter is omitted all groups the user is in are listed.

8.4.6 Displays
--------------

 -- Command: displays
     ('C-a *')
     Shows a tabular listing of all currently connected user front-ends
     (displays).  This is most useful for multiuser sessions.

     The following keys can be used in 'displays' list:

     'k', 'C-p', or 'up' Move up one line.

     'j', 'C-n', or 'down' Move down one line.

     'C-a' or 'home' Move to the first line.

     'C-e' or 'end' Move to the last line.

     'C-u' or 'C-d' Move one half page up or down.

     'C-b' or 'C-f' Move one full page up or down.

     'mouseclick' Move to the selected line.  Available when
     'mousetrack' is set to 'on'.

     'space' Refresh the list.

     'd' Detach the selected display.

     'D' Power detach the selected display.

     'C-g', 'enter', or 'escape' Exit the list.

     The following is an example of what 'displays' could look like:

          xterm 80x42   jnweiger@/dev/ttyp4      0(m11)    &rWx
          facit 80x24   mlschroe@/dev/ttyhf nb  11(tcsh)    rwx
          xterm 80x42   jnhollma@/dev/ttyp5      0(m11)    &R.x
           (A)   (B)       (C)     (D)     (E)  (F)(G)    (H)(I)

     The legend is as follows:
     (A) The terminal type known by 'screen' for this display.
     (B) Displays geometry as width x height.
     (C) Username who is logged in at the display.
     (D) Device name of the display or the attached device
     (E) Display is in blocking or nonblocking mode.  The available
     modes are "nb", "NB", "Z<", "Z>", and "BL".
     (F) Number of the window
     (G) Name/title of window
     (H) Whether the window is shared
     (I) Window permissions.  Made up of three characters:
          (1st character)
              '-' : no read
              'r' : read
              'R' : read only due to foreign wlock
          (2nd character)
              '-' : no write
              '.' : write suppressed by foreign wlock
              'w' : write
              'W' : own wlock
          (3rd character)
              '-' : no execute
              'x' : execute

     'Displays' needs a region size of at least 10 characters wide and 5
     characters high in order to display.

8.4.7 aclumask
--------------

 -- Command: aclumask [USERS]+/-BITS ...
 -- Command: umask [USERS]+/-BITS ...
     (none)
     This specifies the access other users have to windows that will be
     created by the caller of the command.  USERS may be no, one or a
     comma separated list of known usernames.  If no users are
     specified, a list of all currently known users is assumed.  BITS is
     any combination of access control bits allowed defined with the
     'aclchg' command.  The special username '?' predefines the access
     that not yet known users will be granted to any window initially.
     The special username '??' predefines the access that not yet known
     users are granted to any command.  Rights of the special username
     nobody cannot be changed (see the 'su' command).  'Umask' is a
     synonym to 'aclumask'.

8.4.8 Wall
----------

 -- Command: wall MESSAGE
     (none)
     Write a message to all displays.  The message will appear in the
     terminal's status line.

8.4.9 Writelock
---------------

 -- Command: writelock ON|OFF|AUTO
     (none)
     In addition to access control lists, not all users may be able to
     write to the same window at once.  Per default, writelock is in
     'auto' mode and grants exclusive input permission to the user who
     is the first to switch to the particular window.  When he leaves
     the window, other users may obtain the writelock (automatically).
     The writelock of the current window is disabled by the command
     'writelock off'.  If the user issues the command 'writelock on' he
     keeps the exclusive write permission while switching to other
     windows.

 -- Command: defwritelock ON|OFF|AUTO
     (none)
     Sets the default writelock behavior for new windows.  Initially all
     windows will be created with no writelocks.

8.4.10 Su
---------

 -- Command: su [USERNAME [PASSWORD [PASSWORD2]]]
     (none)
     Substitute the user of a display.  The command prompts for all
     parameters that are omitted.  If passwords are specified as
     parameters, they have to be specified un-crypted.  The first
     password is matched against the systems passwd database, the second
     password is matched against the 'screen' password as set with the
     commands 'acladd' or 'password'.  'Su' may be useful for the
     'screen' administrator to test multiuser setups.  When the
     identification fails, the user has access to the commands available
     for user 'nobody'.  These are 'detach', 'license', 'version',
     'help' and 'displays'.

8.5 Session Name
================

 -- Command: sessionname [NAME]
     (none)
     Rename the current session.  Note that for 'screen -list' the name
     shows up with the process-id prepended.  If the argument NAME is
     omitted, the name of this session is displayed.
     _Caution_: The '$STY' environment variable will still reflect the
     old name in pre-existing shells.  This may result in confusion.
     Use of this command is generally discouraged.  Use the '-S'
     command-line option if you want to name a new session.The default
     is constructed from the tty and host names.

8.6 Suspend
===========

 -- Command: suspend
     ('C-a z', 'C-a C-z')
     Suspend 'screen'.  The windows are in the detached state while
     'screen' is suspended.  This feature relies on the parent shell
     being able to do job control.

8.7 Quit
========

 -- Command: quit
     ('C-a \')
     Kill all windows and terminate 'screen'.  (see Key Binding).

9 Regions
*********

Screen has the ability to display more than one window on the user's
display.  This is done by splitting the screen in regions, which can
contain different windows.

9.1 Split
=========

 -- Command: split [-v]
     ('C-a S', 'C-a |')
     Split the current region into two new ones.  All regions on the
     display are resized to make room for the new region.  The blank
     window is displayed on the new region.  The default is to create a
     horizontal split, putting the new regions on the top and bottom of
     each other.  Using -v will create a vertical split, causing the new
     regions to appear side by side of each other.

     With this current implementation of 'screen', scrolling data will
     appear much slower in a vertically split region than one that is
     not.  This should be taken into consideration if you need to use
     system commands such as 'cat' or 'tail -f'.

9.2 Focus
=========

 -- Command: focus
     ('C-a <Tab>')
     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

9.3 Only
========

 -- Command: only
     ('C-a Q')
     Kill all regions but the current one.

9.4 Remove
==========

 -- Command: remove
     ('C-a X')
     Kill the current region.  This is a no-op if there is only one
     region.

9.5 Resize
==========

 -- Command: resize [(+/-)LINES]
     (none)
     Resize the current region.  The space will be removed from or added
     to the region below or if there's not enough space from the region
     above.
          resize +N       increase current region height by N
          resize -N       decrease current region height by N
          resize  N       set current region height to N
          resize  =       make all windows equally high
          resize  max     maximize current region height
          resize  min     minimize current region height

9.6 Caption
===========

 -- Command: caption 'always'|'splitonly' [string]
 -- Command: caption 'string' [string]
     (none)
     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 string escapes (see String Escapes).  'Screen' uses a
     default of '%3n %t'.

     You can mix both forms by providing the string as an additional
     argument.

9.7 Fit
=======

 -- Command: fit
     ('C-a F')
     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.

9.8 Focusminsize
================

 -- Command: focusminsize [ (width|'max'|'_') (height|'max'|'_') ]
     (none)
     This forces any currently selected region to be automatically
     resized at least a certain WIDTH and HEIGHT.  All other surrounding
     regions will be resized in order to accommodate.  This constraint
     follows every time the 'focus' command is used.  The 'resize'
     command can be used to increase either dimension of a region, but
     never below what is set with 'focusminsize'.  The underscore '_' is
     a synonym for 'max'.  Setting a WIDTH and HEIGHT of '0 0' (zero
     zero) will undo any constraints and allow for manual resizing.
     Without any parameters, the minimum width and height is shown.

9.9 Layout
==========

Using regions, and perhaps a large enough terminal, you can give
'screen' more of a desktop feel.  By being able to split regions
horizontally or vertically, you can take advantage of the lesser used
spaces of your terminal.  The catch to these splits has been that
they're not kept between screen detachments and reattachments.

   Layouts will help organize your regions.  You can create one layout
of four horizontal regions and then create a separate layout of regions
in a two by two array.  The regions could contain the same windows, but
they don't have to.  You can easily switch between layouts and keep them
between detachments and reattachments.

   Note that there are several subcommands to 'layout'.

 -- Command: layout 'new' [title]
     (none)
     Create a new layout.  The screen will change to one whole region
     and be switched to the blank window.  From here, you build the
     regions and the windows they show as you desire.  The new layout
     will be numbered with the smallest available integer, starting with
     zero.  You can optionally give a title to your new layout.
     Otherwise, it will have a default title of 'layout'.  You can
     always change the title later by using the command 'layout title'.

 -- Command: layout 'remove' [n|title]
     (none)
     Remove, or in other words, delete the specified layout.  Either the
     number or the title can be specified.  Without either
     specification, 'screen' will remove the current layout.

     Removing a layout does not affect your set windows or regions.

 -- Command: layout 'next'
     (none)
     Switch to the next layout available

 -- Command: layout 'prev'
     (none)
     Switch to the previous layout available

 -- Command: layout 'select' [n|title]
     (none)
     Select the desired layout.  Either the number or the title can be
     specified.  Without either specification, 'screen' will prompt and
     ask which screen is desired.  To see which layouts are available,
     use the 'layout show' command.

 -- Command: layout 'show'
     (none)
     List on the message line the number(s) and title(s) of the
     available layout(s).  The current layout is flagged.

 -- Command: layout 'title' [title]
     (none)
     Change or display the title of the current layout.  A string given
     will be used to name the layout.  Without any options, the current
     title and number is displayed on the message line.

 -- Command: layout 'number' [n]
     (none)
     Change or display the number of the current layout.  An integer
     given will be used to number the layout.  Without any options, the
     current number and title is displayed on the message line.

 -- Command: layout 'attach' [title|':last']
     (none)
     Change or display which layout to reattach back to.  The default is
     ':last', which tells 'screen' to reattach back to the last used
     layout just before detachment.  By supplying a title, You can
     instruct 'screen' to reattach to a particular layout regardless
     which one was used at the time of detachment.  Without any options,
     the layout to reattach to will be shown in the message line.

 -- Command: layout 'save' [n|title]
     (none)
     Remember the current arrangement of regions.  When used, 'screen'
     will remember the arrangement of vertically and horizontally split
     regions.  This arrangement is restored when a 'screen' session is
     reattached or switched back from a different layout.  If the
     session ends or the 'screen' process dies, the layout arrangements
     are lost.  The 'layout dump' command should help in this siutation.
     If a number or title is supplied, 'screen' will remember the
     arrangement of that particular layout.  Without any options,
     'screen' will remember the current layout.

     Saving your regions can be done automatically by using the 'layout
     autosave' command.

 -- Command: layout 'autosave' ['on'|'off']
     (none)
     Change or display the status of automatically saving layouts.  The
     default is 'on', meaning when 'screen' is detached or changed to a
     different layout, the arrangement of regions and windows will be
     remembered at the time of change and restored upon return.  If
     autosave is set to 'off', that arrangement will only be restored to
     either to the last manual save, using 'layout save', or to when the
     layout was first created, to a single region with a single window.
     Without either an 'on' or an 'off', the current status is displayed
     on the message line.

 -- Command: layout 'dump' [filename]
     (none)
     Write to a file the order of splits made in the current layout.
     This is useful to recreate the order of your regions used in your
     current layout.  Only the current layout is recorded.  While the
     order of the regions are recorded, the sizes of those regions and
     which windows correspond to which regions are not.  If no filename
     is specified, the default is 'layout-dump', saved in the directory
     that the 'screen' process was started in.  If the file already
     exists, 'layout dump' will append to that file.  As an example:
          layout dump /home/user/.screenrc
     will save or append the layout to the user's '.screenrc' file.

10 Window Settings
******************

These commands control the way 'screen' treats individual windows in a
session.  See Virtual Terminal, for commands to control the terminal
emulation itself.

10.1 Naming Windows (Titles)
============================

You can customize each window's name in the window display (viewed with
the 'windows' command (see Windows) by setting it with one of the
title commands.  Normally the name displayed is the actual command name
of the program created in the window.  However, it is sometimes useful
to distinguish various programs of the same name or to change the name
on-the-fly to reflect the current state of the window.

   The default name for all shell windows can be set with the
'shelltitle' command (see Shell).  You can specify the name you want
for a window with the '-t' option to the 'screen' command when the
window is created (see Screen Command).  To change the name after
the window has been created you can use the title-string escape-sequence
('<ESC> k NAME <ESC> \') and the 'title' command (C-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 predefined names to keys with the 'title' command to set
things quickly without prompting.

10.1.1 Title Command
--------------------

 -- Command: title [windowtitle]
     ('C-a A')
     Set the name of the current window to WINDOWTITLE.  If no name is
     specified, screen prompts for one.

10.1.2 Dynamic Titles
---------------------

'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 specified name (e.g.  NAME:CMD).
Otherwise the current command name supersedes the shell name while it is
running.

   Here's how it works: you must modify your shell prompt to output a
null title-escape-sequence (<ESC> k <ESC> \) 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 '!', '%', 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 more
accurate titles when using job control or history recall commands.

10.1.3 Setting up your prompt for shell titles
----------------------------------------------

One thing to keep in mind when adding a null title-escape-sequence to
your prompt is that some shells (like the csh) count all the non-control
characters as part of the prompt's length.  If these invisible
characters aren't a multiple of 8 then 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' not only normalizes the character
attributes, but all the zeros round the length of the invisible
characters up to 8.

   Tcsh handles escape codes in the prompt more intelligently, so you
can specify your prompt like this:

     set prompt="%{\ek\e\\%}\% "

   Bash users will probably want to echo the escape sequence in the
PROMPT_COMMAND:

     PROMPT_COMMAND='printf "\033k\033\134"'

   (I used '\134' to output a '\' because of a bug in v1.04).

10.1.4 Setting up shell titles in your '.screenrc'
--------------------------------------------------

Here are some .screenrc examples:

     screen -t top 2 nice top

   Adding this line to your .screenrc would start a niced version of the
'top' command in window 2 named 'top' rather than 'nice'.

     shelltitle '> |csh'
     screen 1

   This file would start a shell using 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:

     /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:' su

   Having this command in your .screenrc would bind the key sequence
'C-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:

     % !em
     emacs 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
     bind E title ""
     bind u title (unknown)

   The first binding doesn't have any arguments, so it would prompt you
for a title when you type 'C-a o'.  The second binding would clear an
auto-titles current setting (C-a E). The third binding would set the
current window's title to '(unknown)' (C-a u).

10.2 Console
============

 -- Command: console [STATE]
     (none)
     Grabs or un-grabs the machines console output to a window.  When
     the argument is omitted the current state is displayed.  _Note_:
     Only the owner of '/dev/console' can grab the console output.  This
     command is only available if the host supports the ioctl
     'TIOCCONS'.

10.3 Kill
=========

 -- Command: kill
     ('C-a k', 'C-a C-k')
     Kill the current window.
     If there is an 'exec' command running (see Exec) then it is
     killed.  Otherwise the process (e.g.  shell) running in the window
     receives a 'HANGUP' condition, the window structure is removed and
     screen (your display) switches to another window.  When the last
     window is destroyed, 'screen' exits.  After a kill screen switches
     to the previously displayed window.
     _Caution_: 'emacs' users may find themselves killing their 'emacs'
     session when trying to delete the current line.  For this reason,
     it is probably wise to use a different command character (see
     Command Character) or rebind 'kill' to another key sequence, such
     as 'C-a K' (see Key Binding).

10.4 Login
==========

 -- Command: deflogin state
     (none)
     Same as the 'login' command except that the default setting for new
     windows is changed.  This defaults to 'on' unless otherwise
     specified at compile time (see Installation).  Both commands
     are only present when 'screen' has been compiled with utmp support.

 -- Command: login [state]
     ('C-a L')
     Adds or removes the entry in '/var/run/utmp' for the current
     window.  This controls whether or not the window is "logged in".
     In addition to this toggle, it is convenient to have "log in" and
     "log out" keys.  For instance, 'bind I login on' and 'bind O login
     off' will map these keys to be 'C-a I' and 'C-a O' (see Key Binding).

10.5 Mode
=========

 -- Command: defmode mode
     (none)
     The mode of each newly allocated pseudo-tty is set to MODE.  MODE
     is an octal number as used by chmod(1).  Defaults to 0622 for
     windows which are logged in, 0600 for others (e.g.  when '-ln' was
     specified for creation, see Screen Command).

10.6 Monitoring
===============

 -- Command: activity message
     (none)
     When any activity occurs in a background window that is being
     monitored, 'screen' displays a notification in the message line.
     The notification message can be redefined by means of the
     'activity' command.  Each occurrence of '%' in MESSAGE is replaced
     by the number of the window in which activity has occurred, and
     each occurrence of '^G' is replaced by the definition for bell in
     your termcap (usually an audible bell).  The default message is

          'Activity in window %n'

     Note that monitoring is off for all windows by default, but can be
     altered by use of the 'monitor' command ('C-a M').

 -- Command: defmonitor state
     (none)
     Same as the 'monitor' command except that the default setting for
     new windows is changed.  Initial setting is 'off'.

 -- Command: monitor [state]
     ('C-a M')
     Toggles monitoring of the current window.  When monitoring is
     turned on and the affected window is switched into the background,
     the activity notification message will be displayed in the status
     line at the first sign of output, and the window will also be
     marked with an '@' in the window-status display (see Windows).
     Monitoring defaults to 'off' for all windows.

 -- Command: silence [STATE|SEC]
     ('C-a _')
     Toggles silence monitoring of windows.  When silence is turned on
     and an affected window is switched into the background, you will
     receive the silence notification message in the status line after a
     specified period of inactivity (silence).  The default timeout can
     be changed with the 'silencewait' command or by specifying a number
     of seconds instead of 'on' or 'off'.  Silence is initially off for
     all windows.

 -- Command: defsilence state
     (none)
     Same as the 'silence' command except that the default setting for
     new windows is changed.  Initial setting is 'off'.

 -- Command: silencewait SECONDS
     (none)
     Define the time that all windows monitored for silence should wait
     before displaying a message.  Default is 30 seconds.

10.7 Windows
============

 -- Command: windows [ string ]
     ('C-a w', 'C-a C-w')
     Uses the message line to display a list of all the windows.  Each
     window is listed by number with the name of the program running in
     the window (or its title).

     The current window is marked with a '*'; the previous window is
     marked with a '-'; all the windows that are logged in are marked
     with a '$' (see Login); a background window that has received a
     bell is marked with a '!'; a background window that is being
     monitored and has had activity occur is marked with an '@' (see
     Monitor); a window which has output logging turned on is marked
     with '(L)'; windows occupied by other users are marked with '&' or
     '&&' if the window is shared by other users; windows in the zombie
     state are marked with 'Z'.

     If this list is too long to fit on the terminal's status line only
     the portion around the current window is displayed.

     You can customize the output format to any string you like
     including string escapes (see String Escapes).  In this case,
     if the string parameter is passed, the maximum output size is
     unlimited (instead of 1024 bytes if no parameter is passed).