Skip to main content

OSC 0

AI-Generated Content
This page was generated with the assistance of AI and may contain inaccuracies. It is intended as a placeholder for future human verification. If you spot issues ahead of its initial review, please report them on GitHub!
Experimental

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
Formal syntax
OSC0 = 0x1b, "]", "0", ";", text, ( 0x07 | 0x1b, "\\" ) ;
text = character, { character } ;

Parameters​

ParameterDescriptionDefault
PtThe 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.

note

OSC 0 sets both the icon name and window title simultaneously. Use OSC 1 to set only the icon name, or OSC 2 to set only the window title.

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​

SpecificationSection
XTerm ctlseqs—

Terminal support​

TerminalSupportVersionNotes
Terminal Emulators
Alacritty~YesIcon names not supported per escape_support.md:95
Bobcat✓0.9.0WhenTitle callback set up from initial release
contour✓v0.1.0Sets both icon and window title
foot✓YesSets icon and window title, osc.c:1299-1301
Ghostty✓v1.0.0
iTerm2✓v20260216-nightly
Kitty✓YesSets both icon and window title
Konsole✓YesIconNameAndWindowTitle enum value 0 in src/session/Session.h:412
mintty✓YesImplemented at termout.c:4686, sets window title (ignores icon title)
mlterm✓rel-2_9_1
PuTTY✓YesSets both icon and window title (terminal.c:3203-3214)
Rio✓v0.0.28
rxvt-unicode✓rxvt-unicode-2.0Sets both icon name and window title
st✓0.4
terminology✓v0.1.0
VT100✗No
VTE✓YesOSC 0 (XTERM_SET_WINDOW_AND_ICON_TITLE) handled in vteseq.cc
WezTerm✓YesOSC 0 SetIconNameAndWindowTitle - see wezterm-escape-parser/src/osc.rs:34,306,458
Windows Terminal✓YesSetIconAndWindowTitle case in ActionOscDispatch, calls SetWindowTitle
xterm✓YesOSC 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.8Requires 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