System Servicesterminalmultiplexervt100ansidetachreattach

screen

GNU Screen is a terminal multiplexer that runs several separate screens on a single physical character-based terminal. Screen sessions can be detached and resumed later on a different terminal.

Description

Screen provides VT100/ANSI terminal emulation and supports multiple virtual terminals on one physical terminal. Each virtual terminal emulates a DEC VT100 plus several ANSI X3.64 and ISO 2022 functions. Sessions can be detached and reattached later, even from different terminals.

It includes features like configurable input and output translation, serial port support, configurable logging, and multi-user support. This makes it useful for maintaining persistent terminal sessions, especially in remote or unstable connections.

Screen is particularly valuable for long-running processes that need to survive network interruptions or for managing multiple shell sessions efficiently.

How It Works

Screen creates virtual terminals emulating VT100/ANSI standards with support for ANSI X3.64 and ISO 2022 functions. It multiplexes multiple sessions on a single physical terminal, allowing detachment and reattachment. Features include scrollback history buffers, flow control, logging, UTF-8 encoding, and multi-display/multi-user modes via socket-based session management.

Installation

bash
sudo apt install screen

Flags

-4Resolve hostnames only to IPv4 addresses.
-6Resolve hostnames only to IPv6 addresses.
-aForce all capabilities into each window's termcap.
-A -[r|R]Adapt all windows to the new display width & height.
-c fileRead configuration file instead of '.screenrc'.
-d (-r)Detach the elsewhere running screen (and reattach here).
-dmS nameStart as daemon: Screen session in detached mode.
-D (-r)Detach and logout remote (and reattach here).
-D -RRDo whatever is needed to get a screen session.
-e xyChange command characters.
-fFlow control on, -fn = off, -fa = auto.
-h linesSet the size of the scrollback history buffer.
-iInterrupt output sooner when flow control is on.
-ls [match]or -list: Do nothing, just list our SockDir [on possible matches].
-LTurn on output logging.
-Logfile fileSet logfile name.
-mignore $STY variable, do create a new screen session.
-OChoose optimal output rather than exact vt100 emulation.
-p windowPreselect the named window if it exists.
-qQuiet startup. Exits with non-zero return code if unsuccessful.
-QCommands will send the response to the stdout of the querying process.
-r [session]Reattach to a detached screen process.
-RReattach if possible, otherwise start a new session.
-s shellShell to execute rather than $SHELL.
-S socknameName this session <pid>.sockname instead of <pid>.<tty>.<host>.
-t titleSet title. (window's name).
-T termUse term as $TERM for windows, rather than "screen".
-UTell screen to use UTF-8 encoding.
-vPrint "Screen version 4.09.01 (GNU) 20-Aug-23".
-wipe [match]Do nothing, just clean up SockDir [on possible matches].
-xAttach to a not detached screen. (Multi display mode).
-XExecute <cmd> as a screen command in the specified session.

Examples

Display help and usage information for screen.
screen -h
Start screen with options and optional command.
screen [-opts] [cmd [args]]
Reattach to a detached screen session.
screen -r [host.tty]
List screen sessions matching the pattern.
screen -ls [match]
Start a detached screen session as daemon with given name.
screen -dmS name
Reattach to existing session or create new one if none available.
screen -R
Force detach remote session and get a screen session.
screen -D -RR
Updated 2026-04-16kali.org ↗