Screen has the following command-line options:
screenmust redraw parts of the display in order to implement a function.
screentries to restore its old window sizes when attaching to resizable terminals (those with “WS” in its description, e.g.
screen, but detaches the elsewhere running
screensession. It has the same effect as typing ”
C-a d” from
screen's controlling terminal.
-Dis the equivalent to the power detach key. If no session can be detached, this option is ignored. In combination with the
-Roption more powerful effects can be achieved:
-d -r- Reattach a session and if necessary detach it first.
-d -R- Reattach a session and if necessary detach or even create it first.
-d -RR- Reattach a session and if necessary detach or create it. Use the first session if more than one session is available.
-D -r- Reattach a session. If necessary detach and logout remotely first.
-D -R- Attach here and now. In detail this means: If a session is running, then reattach. If necessary detach and logout remotely first. If it was not running create it and notify the user. This is the author's favorite.
-D -RR- Attach here and now. Whatever that means, just do it.
Note: It is always a good idea to check the status of your sessions by means of ”
'a', which can be specified as ”
-e^Aa”. When creating a screen session, this option sets the default command character. In a multiuser session all users added will start off with this command character. But when attaching to an already running session, this option changes only the command character of the attaching user. This option is equivalent to either the commands ”defescape” or ”escape” respectively.
defflow” .screenrc command.
defflow” .screenrc command for details. The use of this option is discouraged.
deflogin” .screenrc command.
screen, but prints a list of pid.tty.host strings and creation timestamps identifying your
screensessions. Sessions marked 'detached' can be resumed with ”
screen -r”. Those marked 'attached' are running and have a controlling terminal. If the session runs in multiuser mode, it is marked 'multi'. Sessions marked as 'unreachable' either live on a different host or are 'dead'. An unreachable session is considered dead, when its name matches either the name of the local host, or the specified parameter, if any. See the
-rflag for a description of how to construct matches. Sessions marked as 'dead' should be thoroughly checked and removed. Ask your system administrator if you are not sure. Remove sessions with the
screento turn on automatic output logging for the windows.
screento ignore the $STY environment variable. With ”
screen -m”, creation of a new session is enforced, regardless whether
screenis called from within another
screensession or not. This flag has a special meaning in connection with the
-d -m- Start
screenin “detached” mode. This creates a new session but doesn't attach to it. This is useful for system startup scripts.
-D -m- This also starts
screenin “detached” mode, but doesn't fork a new process. The command exits if the session terminates.
-X” option to a specific window. As with
selectcommand, ”-” selects the blank window. As a special case for reattach, ”=” brings up the
windowliston the blank window.
-ls” the exit value is as follows: 9 indicates a directory without sessions. 10 indicates a directory with running but not attachable sessions. 11 (or more) indicates 1 (or more) usable sessions. In combination with ”
-r” the exit value is as follows: 10 indicates that there is no session to resume. 12 (or more) indicates that there are 2 (or more) sessions to resume and you should specify which one to choose. In all other cases ”
-q” has no effect.
screensession. No other options (except combinations with
-D) may be specified, though an optional prefix of [pid
.host may be needed to distinguish between multiple detached
screensessions. The second form is used to connect to another user's
screensession which runs in multiuser mode. This indicates that
screenshould look for sessions in another user's directory. This requires setuid-root.
screensession it finds. If successful, all other command-line options are ignored. If no detached session exists, starts a new session using the specified options, just as if
-Rhad not been specified. The option is set by default if
screenis run as a login-shell (actually
-xRR” in that case). For combinations with the
-Doption see there. Note: Time-based session selection is a Debian-specific addition.
/bin/sh” if not defined). This can also be defined through the ”
shell” .screenrc command.
screen -list” and ”
screen -r” actions. It substitutes the default [tty.host] suffix.
shelltitle” .screenrc command.
screenin UTF-8 mode. This option tells
screenthat your terminal sends and understands UTF-8 encoded characters. It also sets the default encoding for new windows to 'utf8'.
screen -ls”, but removes destroyed sessions instead of marking them as 'dead'. An unreachable session is considered dead, when its name matches either the name of the local host, or the explicitly given parameter, if any. See the
-rflag for a description how to construct matches.
screensession. (Multi display mode).
screenrefuses to attach from within itself. But when cascading multiple
screens, loops are not detected; take care.
screensession. You can use the
-roption to tell
screento look only for attached or detached
screensessions. Note that this command doesn't work if the session is password protected.