OSC 0
OSC 0 sets both the icon name and the window title of the terminal. It is the most commonly used title-setting sequence, emitted by default in many shell prompt configurations.
Syntax
OSC 0 ; Pt BEL
OSC 0 ; Pt ST
OSC0 = 0x1b, "]", "0", ";", text, ( 0x07 | 0x1b, "\\" ) ;
text = character, { character } ;Parameters
| Parameter | Description | Default |
|---|---|---|
Pt | The text string to use as both the icon name and window title | (none) |
Description
Per the XTerm control sequences documentation, OSC 0 sets both the icon name and the window title to the string Pt. The icon name historically referred to the label displayed when a window was iconified (minimized) in X11 window managers. In modern desktop environments, the icon name is largely vestigial, and most terminals treat OSC 0 as functionally equivalent to setting the window title alone.
The text parameter Pt is a free-form string. It is terminated by either BEL (0x07) or ST (String Terminator, ESC ). BEL is more commonly used in practice because it is a single byte and avoids potential parsing issues.
Many shell configurations emit OSC 0 from the prompt to display the current working directory or running command in the terminal's title bar. For example, Bash's default PROMPT_COMMAND often includes an OSC 0 sequence.
Examples
# Set window title to "My Terminal"
printf '\e]0;My Terminal\a'
# Set window title using ST terminator
printf '\e]0;My Terminal\e\\'
# Set title to current directory (common in shell prompts)
printf '\e]0;%s\a' "$PWD"
Specifications
| Specification | Section |
|---|---|
| XTerm ctlseqs | — |
Terminal support
| Terminal | Support | Version | Notes |
|---|---|---|---|
| Terminal Emulators | |||
| Alacritty | ~ | Yes | Icon names not supported per escape_support.md:95 |
| Bobcat | ✓ | 0.9.0 | WhenTitle callback set up from initial release |
| contour | ✓ | v0.1.0 | Sets both icon and window title |
| foot | ✓ | Yes | Sets icon and window title, osc.c:1299-1301 |
| Ghostty | ✓ | v1.0.0 | |
| iTerm2 | ✓ | v20260216-nightly | |
| Kitty | ✓ | Yes | Sets both icon and window title |
| Konsole | ✓ | Yes | IconNameAndWindowTitle enum value 0 in src/session/Session.h:412 |
| mintty | ✓ | Yes | Implemented at termout.c:4686, sets window title (ignores icon title) |
| mlterm | ✓ | rel-2_9_1 | |
| PuTTY | ✓ | Yes | Sets both icon and window title (terminal.c:3203-3214) |
| Rio | ✓ | v0.0.28 | |
| rxvt-unicode | ✓ | rxvt-unicode-2.0 | Sets both icon name and window title |
| st | ✓ | 0.4 | |
| terminology | ✓ | v0.1.0 | |
| VT100 | ✗ | No | |
| VTE | ✓ | Yes | OSC 0 (XTERM_SET_WINDOW_AND_ICON_TITLE) handled in vteseq.cc |
| WezTerm | ✓ | Yes | OSC 0 SetIconNameAndWindowTitle - see wezterm-escape-parser/src/osc.rs:34,306,458 |
| Windows Terminal | ✓ | Yes | SetIconAndWindowTitle case in ActionOscDispatch, calls SetWindowTitle |
| xterm | ✓ | Yes | OSC 0 sets both icon name and window title (OSC_IconBoth in misc.c:3480) |
| xterm.js | ✓ | 0.3 | |
| Multiplexers | |||
| cy | ✓ | Yes | |
| GNU Screen | ✓ | v.4.2.0 | |
| tmux | ✓ | 0.8 | Requires allow-set-title option |
| tuios | ✓ | v0.0.15 | |
| Zellij | ✓ | v0.12.0 | |
See also
- OSC 2 — Set Window Title — Sets only the window title without affecting the icon name
- BEL — The bell character commonly used as OSC string terminator