Go to the first, previous, next, last section, table of contents.

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.


Command: autodetach state
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 section Invoking Screen)

Command: password [crypted_pw]
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.

Power Detach

Command: pow_detach
(C-a 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]
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 parameter, the current message is shown.


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.

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.


Command: multiuser state
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.


Command: acladd usernames
Enable users to fully access this screen session. Usernames can be one user or a comma seperated 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. Multi-user mode only.


Command: aclchg usernames permbits list
Change permissions for a comma seperated list of users. Permission bits are represented as `r', `w' and `x'. Prefixing `+' grants the permission, `-' removes it. The third parameter is a comma seperated 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 is 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 readonly 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. Multi-user mode only.


Command: 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.


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


Command: writelock on|off|auto
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
Sets the default writelock behaviour for new windows. Initially all windows will be created with automatic writelocks.

Session Name

Command: sessionname [name]
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 still reflects the old name. This may result in confusion. The default is constructed from the tty and host names.


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.


Command: quit
(C-a C-\)
Kill all windows and terminate screen. Note that on VT100-style terminals the keys C-4 and C-\ are identical. So be careful not to type C-a C-4 when selecting window no. 4. Use the empty bind command (as in bind "^\") to remove a key binding (see section Key Binding).

Go to the first, previous, next, last section, table of contents.