Skip to content

ESC — Escape

Byte0x1B
MnemonicESC
Otty support

Description

The single most important control byte. ESC introduces every multi-byte sequence in the terminal vocabulary — CSI, OSC, ESC-final, DCS, APC, and so on.

A bare ESC (followed by no recognised intermediate / final) resets the parser. In an OSC or DCS payload, ESC begins a string terminator (ESC \).

In shell readline and many editors, the ESC key is also used as a meta prefix — Esc Esc cancels, Esc x enters meta mode.

Example

bash
printf '\e[31m red \e[0m\n'    # CSI SGR red, reset
printf '\e]0;My Title\e\\'     # OSC 0 set title, ESC \ terminator

Otty