Screen has the following command-line options:
-a
screen
must redraw parts of the display in order to implement a function.-A
screen
tries to restore its old window sizes when attaching to resizable terminals (those with “WS” in its description, e.g. suncmd
or some xterm
).-c
file-d
|-D
[pid.
tty.
host]screen
, but detaches the elsewhere running screen
session. It has the same effect as typing “C-a d
” from screen
's controlling terminal. -D
is the equivalent to the power detach key. If no session can be detached, this option is ignored. In combination with the -r
/-R
option 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 “screen -list
”.
-e
xyC-a
” and '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.-f
, -fn
, and -fa
defflow
” .screenrc command.-h
num-i
defflow
” .screenrc command for details. The use of this option is discouraged.-l
and -ln
deflogin
” .screenrc command.-ls
and -list
screen
, but prints a list of pid.tty.host strings and creation timestamps identifying your screen
sessions. 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 -r
flag 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 -wipe
option.-L
screen
to turn on automatic output logging for the windows.-m
screen
to ignore the $STY environment variable. With “screen -m
”, creation of a new session is enforced, regardless whether screen
is called from within another screen
session or not. This flag has a special meaning in connection with the -d
option:-d -m
- Start screen
in “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 screen
in “detached” mode, but doesn't fork a new process. The command exits if the session terminates.
; -O
termcap
” command.-p
number_or_name-X
” option to a specific window. As with screen
's select
command, “-” selects the blank window. As a special case for reattach, “=” brings up the windowlist
on the blank window.-q
-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.-r
sessionowner/
[pid.
tty.
host] -r
[pid.
tty.
host]screen
session. No other options (except combinations with -d
/-D
) may be specified, though an optional prefix of [pid.
]tty.
host may be needed to distinguish between multiple detached screen
sessions. The second form is used to connect to another user's screen
session which runs in multiuser mode. This indicates that screen
should look for sessions in another user's directory. This requires setuid-root.-R
screen
session 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 -R
had not been specified. The option is set by default if screen
is run as a login-shell (actually screen
uses “-xRR
” in that case). For combinations with the -d
/-D
option see there.
Note: Time-based session selection is a Debian-specific addition.-s
/bin/sh
” if not defined). This can also be defined through the “shell
” .screenrc command.-S
sessionnamescreen -list
” and “screen -r
” actions. It substitutes the default [tty.host] suffix.-t
nameshelltitle
” .screenrc command.-U
screen
in UTF-8 mode. This option tells screen
that your terminal sends and understands UTF-8 encoded characters. It also sets the default encoding for new windows to 'utf8'.-v
-wipe
[match]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 -r
flag for a description how to construct matches.-x
screen
session. (Multi display mode). screen
refuses to attach from within itself. But when cascading multiple screen
s, loops are not detected; take care.-X
screen
session. You can use the -d
or -r
option to tell screen
to look only for attached or detached screen
sessions. Note that this command doesn't work if the session is password protected.