Digital Equipment Corporation's iconic video terminal — ancestor of every modern terminal emulator
DEC · 1982 · ANSI X3.64 · 80×24
| Sequence | Mnemonic | Description | Example |
|---|---|---|---|
| ESC[nA | CUU | Cursor Up n rows (default 1) | ESC[3A → up 3 |
| ESC[nB | CUD | Cursor Down n rows | ESC[1B |
| ESC[nC | CUF | Cursor Forward (right) n cols | ESC[5C |
| ESC[nD | CUB | Cursor Back (left) n cols | ESC[2D |
| ESC[nE | CNL | Cursor Next Line n rows down, col 1 | ESC[2E |
| ESC[nF | CPL | Cursor Previous Line n rows up, col 1 | ESC[2F |
| ESC[nG | CHA | Cursor Horizontal Absolute (column n) | ESC[40G |
| ESC[r;cH | CUP | Cursor Position: row r, col c (1-based) | ESC[12;40H |
| ESC[r;cf | HVP | Horizontal Vertical Position (same as CUP) | ESC[1;1f |
| ESC[s | SCP | Save Cursor Position (ANSI) | ESC[s |
| ESC[u | RCP | Restore Cursor Position (ANSI) | ESC[u |
| ESC 7 | DECSC | Save Cursor + attributes (DEC private) | ESC 7 |
| ESC 8 | DECRC | Restore Cursor + attributes (DEC private) | ESC 8 |
| ESC[6n | DSR | Device Status Report → terminal replies ESC[r;cR | → ESC[12;40R |
| Sequence | Mnemonic | Description |
|---|---|---|
| ESC[J / ESC[0J | ED | Erase from cursor to end of display |
| ESC[1J | ED | Erase from start of display to cursor |
| ESC[2J | ED | Erase entire display (cursor does NOT move) |
| ESC[3J | ED | Erase scrollback buffer (xterm extension) |
| ESC[K / ESC[0K | EL | Erase from cursor to end of line |
| ESC[1K | EL | Erase from start of line to cursor |
| ESC[2K | EL | Erase entire current line |
| ESC[nP | DCH | Delete n characters at cursor (shift left) |
| ESC[nM | DL | Delete n lines at cursor (scroll up) |
| ESC[n@ | ICH | Insert n blank characters at cursor |
| ESC[nL | IL | Insert n blank lines at cursor |
16 standard colors + 216 RGB cube (6×6×6) + 24 grayscale ramp. Hover for color index.
Hue sweep — all hues at full saturation:
Lightness ramp — black to white: