Skip to main content
ansicode
Terminal

GNU screen — ANSI escape code support

GNU screen is the original terminal multiplexer — first released by Oliver Laumann at the Berlin Technical University in 1987, BSD-licensed since 1989, in the GNU project since 1995. It predates tmux by 20 years and still ships in every major distro plus macOS's `/usr/bin/screen`. The canonical multiplexer terminfo entry `screen-256color` (and the older `screen`) is named after it; every modern multiplexer including tmux historically aliased to `screen-256color` for compatibility.

For ANSI escape codes the picture in 2026 is rougher than tmux because the upstream release cadence is glacial: screen 4.x lasted from 2003 to 2024, screen 5.0.0 (April 2024) was the first release in 21 years to add 24-bit truecolor parsing, and Apple's `/usr/bin/screen` on macOS Sonoma still ships v4.00.03 from 2006 — silently downgrading every `\x1b[38;2;…m` sequence to the nearest 16-colour index. OSC 8 hyperlinks, styled underlines (SGR 4:3–4:5), strikethrough (SGR 9), focus events, sixel and Kitty graphics are all stripped by screen 5.0 — they never reach the outer terminal. If you need a modern multiplexer in 2026, choose tmux; choose screen only when the host can't install anything new (legacy servers, restricted base images) or you specifically want screen's `screenrc` ecosystem.

Last updated

Feature support

How this terminal scores against the 15 features tracked in the site-wide support matrix. Click any feature name to see the full row across every terminal.

  • 8 basic colors (30–37 / 40–47)SGR 30–37 foreground, 40–47 background.
    yes
  • Bright (aixterm) colors (90–97 / 100–107)aixterm SGR extension.
    yes
  • 256-color palette (38;5;n / 48;5;n)xterm 256-color extension.
    partial
  • 24-bit truecolor (38;2;r;g;b)16.7M direct RGB. Set $COLORTERM=truecolor.
    partial
  • Italic (SGR 3)Italic text attribute.
    partial
  • Styled underlines (4:1–4:5)Curly/dotted/dashed underline styles.
    no
  • Strikethrough (SGR 9)Horizontal line through text.
    no
  • OSC 8 hyperlinksInline clickable URIs.
    no
  • Alt screen (?1049h)Full-screen app buffer.
    yes
  • Mouse tracking (SGR ?1006)Mouse click/drag events.
    partial
  • Bracketed paste (?2004)Pasted text wrapped in ESC[200~/ESC[201~.
    partial
  • Focus events (?1004)ESC[I on focus in, ESC[O on focus out.
    no
  • Sixel graphicsDEC sixel inline raster images.
    no
  • Kitty graphics protocolPNG/RGB inline images, animations.
    no
  • Synchronized output (?2026)Atomic frame updates to avoid tearing.
    no

Sequences that work here

Canonical reference pages for the escape sequences this terminal handles cleanly. Each links to a full page with byte forms, citations, and per-language examples.

Quirks & version notes

Per-terminal caveats you'll want to know before relying on a sequence in production.

Truecolor only since screen 5.0 (April 2024) — and not on macOS
GNU screen 5.0.0 was the first release in 21 years to add a parser for `\x1b[38;2;r;g;b m` and `\x1b[48;2;r;g;b m`. Any older release (Ubuntu 22.04 LTS ships 4.09.00, Debian Bookworm ships 4.09.00, every existing macOS ships 4.00.03 from 2006) silently quantises truecolor SGR to the nearest 16-colour value — there is no `Tc`/`RGB` capability flag you can flip to make it work. To detect: `screen --version` (need `5.0.0` or later) and `infocmp screen-256color | grep RGB`. The portable workaround is to emit 256-indexed colour as the lowest-common-denominator inside any screen session you don't control the version of.
OSC 8 hyperlinks, styled underlines, strikethrough — all stripped
Screen's escape-sequence parser is hand-coded against the original VT100/VT220 manual plus a small set of post-1987 extensions. Anything newer than that — OSC 8 (2017), SGR 4:3/4:4/4:5 styled underlines (xterm 341, 2018), SGR 9 strikethrough — is not recognised; the offending bytes are dropped before they reach the outer terminal, but the visible payload text (the link's anchor, the underlined / struck-through word) is still printed unstyled. There is no passthrough mode — unlike tmux 3.3+'s `allow-passthrough on`, GNU screen never forwards unrecognised escape sequences. If your application needs any of these features inside a multiplexer, use tmux.
$TERM=screen-256color and the terminfo crawl
When screen launches a shell, it sets `$TERM=screen-256color` by default (or `screen` on older systems whose terminfo database doesn't include the 256-colour entry — `infocmp screen-256color` will fail in that case and you'll need ncurses ≥ 5.0). The entry advertises 256 colours, italic (since ncurses 6.0; absent before), but never advertises `RGB` / `Tc` truecolor and never advertises `Smulx` styled-underline. Override per-shell with `TERM=screen-256color`; override per-screenrc with `term screen-256color`. Cross-multiplexer applications that need to detect "running inside any multiplexer" should check `$STY` (set by screen) or `$TMUX` (set by tmux), not `$TERM` (which can mislead — every emulator under the sun aliases to `screen-256color` for compatibility reasons).
macOS /usr/bin/screen is from 2006 — use Homebrew screen for anything modern
Apple has not updated `/usr/bin/screen` since macOS 10.5 Leopard. As of macOS Sonoma / Sequoia in 2026, `screen --version` reports `Screen version 4.00.03 (FAU) 23-Oct-06`. This pre-dates the 256-colour entry shipping in ncurses, pre-dates UTF-8 support being a default, and obviously pre-dates the 2024 truecolor release. Install Homebrew's `brew install screen` to get the current 5.0.x, then either replace `/usr/bin/screen` in `$PATH` with `/opt/homebrew/bin/screen` or alias it. If you do not switch, you also lose `screen-256color` italic — applications using terminfo `italic` capability will silently fall back to plain text.
Bracketed paste, focus events, sixel — none of them
DEC private modes ?2004 (bracketed paste), ?1004 (focus events), and the DCS sixel envelope are all parsed-and-ignored by screen. Pasting a multi-line shell prompt into screen still triggers Bash autocompletion / multi-line replay because there is no `\x1b[200~`/`\x1b[201~` framing; editors that rely on focus events to autosave never receive them; sixel images print as garbled C1 bytes. Unlike OSC 8, these have never been on the screen project's roadmap — they're either too niche (focus events) or fundamentally incompatible with screen's character-grid model (sixel). The conservative emit strategy when you know the host is screen: skip these features and degrade gracefully.
Detach / reattach preserves the inner state — including SGR
When you detach a screen session with Ctrl-A d and reattach later (possibly from a different SSH session, possibly to a different outer terminal entirely), screen replays its persisted character-grid + SGR state to the new outer terminal. This works because screen stores the rendered grid, not the original byte stream — so if you emit 24-bit `\x1b[38;2;255;0;0m` on screen 5.0, attach later from a non-truecolor outer terminal, the colour is quantised by screen's own renderer before being repainted, not lost. The same persistence mechanism means a `clear` command issued inside the session sticks across re-attaches; transient bytes (mouse-wiggle reports, DA responses) are answered immediately at the time of generation and never replayed.

Citations

Other terminals with landing pages