$linuxjunkies
>

OSC sequence

also: Operating System Command sequence, ESC ] sequence

A special escape sequence that allows programs to communicate control commands to terminal emulators, controlling colors, window titles, clipboard operations, and other terminal behavior.

OSC (Operating System Command) sequences are escape sequences that begin with ESC ] and end with either BEL (bell character) or ESC \ (ST, string terminator). They enable programs running in a terminal to send commands to the terminal emulator itself, rather than just displaying text.

Common uses include setting the window title, changing the color palette, manipulating the clipboard, and reporting terminal capabilities. For example, echo -e '\033]0;My Window Title\007' sets the terminal window title.

OSC sequences are distinct from CSI (Control Sequence Introducer) sequences used for cursor movement and text formatting. Modern terminal applications like tmux, vim, and kitty use OSC sequences to enhance functionality, such as OSC 8 for hyperlinks or OSC 52 for clipboard access.

Related terms