Screen

Introduction

Screen is a Tool, to configure a Session to be able to leave it, log out and reconnect to it later on.

To use it, it has to be installed. It does not support GUI applications.

Step by Step

Starten einer Screen-Session. Der Name (-S) ist optional, erleichtert aber später die Unterscheidung mehrerer Sessions.
Starten einer Screen-Session. Der Name (-S) ist optional, erleichtert aber später die Unterscheidung mehrerer Sessions.
Neue Session aktiv
Neue Session aktiv
in dieser Session top gestartet, dann Ctrl-a d  das löst die Session ab (detached)
in dieser Session top gestartet, dann Ctrl-a d das löst die Session ab (detached)
Zweite Screen-Session öffnen
Zweite Screen-Session öffnen
ls in der zweiten Session und wieder abhängen
ls in der zweiten Session und wieder abhängen
zurück in der Ursprungsshell
zurück in der Ursprungsshell
Wiederanhängen einer Sesson. -R würde eine einzige ohne Nachfrage anhängen, wir haben aber zwei, deswegen wird gelistet, welche es gibt
Wiederanhängen einer Sesson. -R würde eine einzige ohne Nachfrage anhängen, wir haben aber zwei, deswegen wird gelistet, welche es gibt
Anhänger mit Angabe der Session
Anhänger mit Angabe der Session
Das top läuft noch immer
Das top läuft noch immer
Anhängen der anderen Session
Anhängen der anderen Session
Der Inhalt des letzten Fensters, oder ggf laufender Job wird damit wieder sicht- und nutzbar.
Der Inhalt des letzten Fensters, oder ggf laufender Job wird damit wieder sicht- und nutzbar.

-c file
override the default configuration file from "$HOME/.screenrc" to file.
-h num
Specifies the history scrollback buffer to be num lines high.
-L tells screen to turn on automatic output logging for the windows.

-Logfile file
By default logfile name is "screenlog.0". You can set new logfile name with the "-Logfile" option.
-r [pid.tty.host]
-r sessionowner/[pid.tty.host]
resumes a detached 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 resumes screen only when it's unambiguous which one to attach, usually when only one screen is detached.
Otherwise lists available sessions. -RR attempts to resume the first detached 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.
-S sessionname
When creating a new session, this option can be used to specify a meaningful name for the session. This
name identifies the session for "screen -list" and "screen -r" actions. It substitutes the default
[tty.host] suffix.

-t name
sets the title (a.k.a.) for the default shell or specified program. See also the "shelltitle" .screenrc
command.
-U Run 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'.
-4 Resolve hostnames only to IPv4 addresses.

-6 Resolve hostnames only to IPv6 addresses.
 

C-a ' (select) Prompt for a window name or number to switch to.

Ctrl a d

C-a " (windowlist -b)
Present a list of all windows for selection.
C-a 0 (select 0)
… …
C-a 9 (select 9)
C-a tab (focus) Switch the input focus to the next region. See also split, remove, only.
C-a A (title) Allow the user to enter a name for the current window.
C-a d
C-a C-d (detach) Detach screen from this terminal.

 

The "socket directory" defaults either to $HOME/.screen or simply to /tmp/screens or preferably to
/usr/local/screens chosen at compile-time. If screen is installed setuid-root, then the administrator should
compile screen with an adequate (not NFS mounted) socket directory. If screen is not running setuid-root, the
user can specify any mode 700 directory in the environment variable $SCREENDIR.
When screen is invoked, it executes initialization commands from the files "/etc/screenrc" and ".screenrc" in
the user's home directory. These are the "programmer's defaults" that can be overridden in the following ways:
for the global screenrc file screen searches for the environment variable $SYSSCREENRC (this override feature
may be disabled at compile-time). The user specific screenrc file is searched in $SCREENRC, then
$HOME/.screenrc. The command line option -c takes precedence over the above user screenrc files.

Commands in these files are used to set options, bind functions to keys, and to automatically establish one or
more windows at the beginning of your screen session. Commands are listed one per line, with empty lines
being ignored. A command's arguments are separated by tabs or spaces, and may be surrounded by single or dou‐
ble quotes. A `#' turns the rest of the line into a comment, except in quotes. Unintelligible lines are
warned about and ignored. Commands may contain references to environment variables. The syntax is the shell-
like "$VAR " or "${VAR}". Note that this causes incompatibility with previous screen versions, as now the
'$'-character has to be protected with '\' if no variable substitution shall be performed. A string in single-
quotes is also protected from variable substitution.

Two configuration files are shipped as examples with your screen distribution: "etc/screenrc" and "etc/etc‐
screenrc". They contain a number of useful examples for various commands.

Customization can also be done 'on-line'. To enter the command mode type `C-a :'. Note that commands starting
with "def" change default values, while others change current settings.

The following commands are available:

acladd usernames [crypted-pw]
addacl usernames
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 "#?"'. executed. To add a user with restricted access, use the `aclchg' command below. If an optional
second parameter is supplied, it should be a crypted password for the named user(s). `Addacl' is a synonym to
`acladd'. Multi user mode only.

aclchg usernames permbits list
chacl usernames permbits list

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
and/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 window 2: `aclchg username -w+w 2'. To allow read-only access to the session: `aclchg user‐
name -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. Rights of the special username
nobody cannot be changed (see the "su" command). `Chacl' is a synonym to `aclchg'. Multi user mode only.

acldel username

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.
aclgrp username [groupname]

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.

aclumask [[users]+bits |[users]-bits …. ]
umask [[users]+bits |[users]-bits …. ]

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'.

JavaScript has been disabled in your browser