Appearance
Operating System Commands (OSC)
Operating System Command (OSC) sequences use the ESC ] format for out-of-band communication between applications and the terminal emulator. Unlike CSI sequences which control the terminal's display, OSC sequences communicate with the "operating system" (the terminal application itself). Key sequences: window title (OSC 0/2), clipboard access (OSC 52), hyperlinks (OSC 8), color palette queries (OSC 4/10/11), semantic prompt markers (OSC 133), and notification (OSC 9/777). The OSC namespace is open-ended — any terminal can define new numbers without conflicting with CSI-based control codes. This open-endedness is both a strength and a weakness: it allows rapid innovation (iTerm2 alone defines dozens of proprietary OSC sequences), but there is no registry or coordination — terminals occasionally pick the same number for different purposes.
The OSC protocol structure is ESC ] Ps ; Pt ST — a numeric identifier, a semicolon, the payload, and a string terminator (ESC \ or BEL). This format is both its simplicity and its limitation: the number namespace is flat (no hierarchy), and there is no formal registry. OSC 52 (ESC ]52;c;base64-data ST) provides clipboard access — an application can read and write the system clipboard through the terminal, which is essential for remote vim/tmux sessions over SSH where the system clipboard isn't directly accessible.
OSC 8 (ESC ]8;params;url ST) brings clickable hyperlinks to the terminal. Text between an OSC 8 open and close sequence becomes a link — ls can link filenames to file:// URLs, compiler errors can link to source locations, and git log can link commit hashes to GitHub. Adopted by Ghostty, iTerm2, WezTerm, foot, and most modern terminals. Notably absent from Terminal.app.
OSC 133 defines semantic prompt markers — shell integration that tells the terminal where prompts, commands, and output begin and end. This powers VS Code's command decorations, iTerm2's command history navigation, and Ghostty's prompt-to-prompt scrolling. Each shell (bash, zsh, fish) emits slightly different markers, making robust integration a cross-platform challenge.
Sources
Unlike CSI sequences which are defined by ECMA-48, OSC numbers have no central registry. The features tracked here come from multiple independent sources:
- Xterm Extensions — The de facto reference. Defines OSC 0–7 (title, icon, CWD), OSC 10–19 (dynamic colors), OSC 22 (pointer shape), OSC 50–52 (font, clipboard), and their resets (OSC 104–119). Most widely adopted OSCs originate here.
- ConEmu Extensions — OSC 9 subtypes including 9;4 (progress bar), 9;9 (CWD). The progress bar protocol has been widely adopted by Ghostty, iTerm2, Windows Terminal, WezTerm, and others.
- iTerm2 Extensions — OSC 1337 namespace with subcommands for inline images, cell size reporting, capability queries, annotations, and more. Some features (images, cell size) adopted by other terminals.
- Kitty Extensions — OSC 66 (text sizing), OSC 5522 (advanced clipboard with MIME types). Newer protocols designed to address limitations of OSC 52.
- VS Code Extensions — OSC 633 for VS Code-specific shell integration, extending OSC 133 with additional markers for command line capture and properties.
- FinalTerm semantic prompts — OSC 133, the original shell integration protocol. Prompt/command/output markers now adopted by iTerm2, VS Code, Ghostty, and others.
Analysis2026-04-06
Terminal Applications
Headless Backends
Parser correctness tested via Termless. A ✓ means the parser accepts the sequence, not that it renders correctly.