tmux — ANSI escape code support
tmux is a terminal multiplexer — a layer that runs between your shell and the real terminal emulator, so a single window can host many independent panes and a detached session survives the window closing. It was first released by Nicholas Marriott in 2007 as a BSD-licensed replacement for GNU screen, and in 2026 it ships pre-built on every major Linux distro, in Homebrew, and as part of FreeBSD's base system.
For ANSI escape codes the multiplexer position matters: tmux owns its own terminal emulator (the inner one your apps talk to) and forwards a re-encoded sequence stream up to the outer terminal that's rendering the window. Most escapes pass through cleanly (every SGR colour code, cursor motion, erase) but a handful are intercepted by tmux itself — alt-screen, mouse, focus events, OSC 8 hyperlinks — and a few never make it (the Kitty graphics protocol fights tmux's character-grid model and corrupts under it). The #1 friction point everyone hits first is truecolor: tmux requires both set -g default-terminal "tmux-256color" and set -ga terminal-overrides ",*256col*:Tc" (or ,*:RGB) in ~/.tmux.conf before 24-bit SGR is forwarded; without the override \x1b[38;2;255;0;0m gets silently quantised to the nearest 256-palette index.
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.yes
- 24-bit truecolor (38;2;r;g;b)16.7M direct RGB. Set $COLORTERM=truecolor.partial
- Italic (SGR 3)Italic text attribute.yes
- Styled underlines (4:1–4:5)Curly/dotted/dashed underline styles.partial
- Strikethrough (SGR 9)Horizontal line through text.yes
- OSC 8 hyperlinksInline clickable URIs.partial
- 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~.yes
- Focus events (?1004)ESC[I on focus in, ESC[O on focus out.partial
- Sixel graphicsDEC sixel inline raster images.partial
- Kitty graphics protocolPNG/RGB inline images, animations.no
- Synchronized output (?2026)Atomic frame updates to avoid tearing.partial
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.
- SGR 38;2;R;G;B — 24-bit truecolor foreground
\x1b[38;2;R;G;BmPick any of 16,777,216 foreground RGB colors directly.
- DECSET 1049 — Alternate screen buffer
\x1b[?1049h (enter) \x1b[?1049l (leave)Switch to a separate screen buffer (like vim/less do on launch).
- DECSET ?1000 / ?1006 — Mouse tracking
\x1b[?1000h (click only) \x1b[?1002h (cell drag) \x1b[?1003h (any motion) \x1b[?1006h (SGR encoding)Receive mouse click / drag / scroll events as escape sequences.
- OSC 8 — Inline hyperlink
\x1b]8;;URI\x07TEXT\x1b]8;;\x07Render clickable hyperlinks in terminal output (gnome-terminal 3.26+, iTerm2, Windows Terminal, kitty, ...).
- DECSET ?1004 — Focus in/out events
\x1b[?1004h (enable) \x1b[?1004l (disable)Make the terminal report when its window gains or loses keyboard focus.
Quirks & version notes
Per-terminal caveats you'll want to know before relying on a sequence in production.
- Truecolor needs explicit terminal-overrides — the #1 friction point
- tmux gates 24-bit SGR forwarding on whether the outer terminal's terminfo entry advertises the
Tc(orRGB) capability. Most distros' defaultxterm-256colorentry doesn't — so tmux quantises\x1b[38;2;…mto the nearest 256-palette index. The fix is two lines in~/.tmux.conf:set -g default-terminal "tmux-256color"(sets$TERM*inside* the multiplexer, separate from the outer$TERM) andset -ga terminal-overrides ",*256col*:Tc"(adds theTccapability for any terminfo entry matching*256col*). After reloading (tmux source ~/.tmux.conf) verify withtmux info | grep -E '(Tc|RGB)'— both should be flagged true. The newer,*:RGBform (tmux ≥ 2.7) is preferred for new configs sinceRGBis the standards-track capability whileTcwas a tmux-private extension. - OSC 8 hyperlink passthrough — only since tmux 3.4 (April 2024)
- tmux 3.4 was the release that finally re-emits
\x1b]8;;https://…\x1b\\to the outer terminal. Earlier versions stripped the OSC bytes and kept only the visible text — clickable links worked outside tmux but degraded to plain text inside. Verify your tmux supports passthrough withtmux -V(need ≥ 3.4) andecho -e '\x1b]8;;https://example.com\x1b\\link\x1b]8;;\x1b\\'while attached. If the outer terminal also supports OSC 8 (iTerm2, kitty, Ghostty, GNOME Terminal, Konsole, WezTerm — see the matrix above), the link is clickable; if not, you still see the visible text. Older tmux releases (3.0–3.3) requireset -g allow-passthrough onto even attempt forwarding, and even then strip OSC 8 specifically. - Alt-screen, mouse, focus events — tmux owns these, not the outer terminal
- Inside tmux, alt-screen toggles (
\x1b[?1049h/?1049l) flip tmux's own buffer, not the outer terminal's — this is how vim/htop/less stay confined to a pane. Mouse-tracking sequences (\x1b[?1000h,?1006h) are intercepted: enable them inside tmux withset -g mouse on, after which tmux relays click coordinates to the focused pane's application *if*set -g mode-mouse onis also set. Focus events (\x1b[?1004h) are off by default — turn on withset -g focus-events onso editors like neovim can react to focus loss. The relevant pattern: applications still send the DEC private-mode sequences they always did; tmux is just the consumer in the middle. - Kitty graphics protocol breaks under tmux
- tmux's character-grid model assumes every output byte updates a single cell; the Kitty graphics protocol (and Ghostty's compatible implementation) sends multi-kilobyte APC sequences that include base64 PNG/RGB data — none of which fits the grid. The famous "tmux destroys kitty graphics" issue (kovidgoyal/kitty#3027) tracks the upstream conversation; the practical answer in 2026 is: don't render Kitty graphics inside tmux, use the bare terminal. tmux 3.3+ has experimental
allow-passthrough onthat lets the APC bytes through, but the pane redraw cycle still corrupts the image. For inline images that need to survive tmux, prefer sixel — it round-trips through tmux 3.4+ behindallow-passthrough on(still with visual quirks, but the data isn't lost). - $TERM inside tmux is
tmux-256color, not the outer terminal's value - When tmux launches a shell in a pane, it sets
$TERMtotmux-256color(or whateverdefault-terminalis configured to). The outer terminal's$TERM—xterm-256color,iterm2, etc. — is not visible to the inner program. This matters for terminfo-based feature detection:tput colorsreports 256 inside tmux even if the outer terminal supports truecolor; the application has to trust$COLORTERM=truecolor(which tmux *does* forward from the outer environment) or checktmux info | grep RGBprogrammatically. Old tmux releases set$TERM=screen-256color, which is the canonical multiplexer terminfo entry but lacks italic and a few other capabilities — bump totmux-256color(ships in ncurses ≥ 6.0) for fewer surprises. - Sequences that vanish: bracketed-paste, DA1/DA2 responses, palette queries
- tmux re-encodes the input stream from the outer terminal before forwarding it to panes — most byte sequences survive, but a few are answered or absorbed by tmux directly. Device Attributes responses (
\x1b[?1;2cafter aCSI cquery) come from tmux, not the outer terminal — apps that probe via DA1 to detect sixel see tmux's capabilities, not what's underneath. Palette queries (OSC 4 ; n ; ? \x07) are similarly answered by tmux's own palette (typically the 256-colour xterm palette), not the outer terminal's themed palette. Bracketed-paste input wrapping (\x1b[200~ … \x1b[201~) is forwarded — tmux 2.6+ also implements it natively so pasting works correctly even into panes whose apps didn't enable the mode.