Escape sequences consist of

1. Escape character; an ASCII control character with the value 0x1B (decimal 27)
2. Left square bracket
3. Zero, one, or more numeric arguments. Multiple numeric arguments are separated by semicolons
4. A one-letter, case-sensitive code specifying the action to take: move cursor, change text color, clear screen, etc.

In the table below, denotes the Escape character.

Escape sequence | Action | Environments where supported
--- | --- | ---
DOS ANSI.SYS | Linux console
[nA | Moves cursor up n rows | X | X
[nB | Moves cursor down n rows | X | X
[nC | Moves cursor right n columns | X | X
[nD | Moves cursor left n columns | X | X
[y;xH | Moves cursor to position (x, y). The upper left corner of the screen is (1,1) | X | X
[2J | Clears screen and moves cursor to home position (1,1) | X | X
[K | Erases line; from cursor position (including character under cursor) to end of line | X | X
[y;xf | Same as [y;xH | X | X
[s | Pushes current cursor position on an internal stack | X | X
[u | Pops last cursor position saved by [s and moves cursor to that position | X | X
[im [i;jm [i;j;km | Sets text attributes. i, j, and k may have any of the following values:
i, j, k | Attribute | i, j, k | Attribute
--- | --- | --- | ---
0 | All attributes off | 1 | Bold
4 | Underscore (not supported on all displays) | 5 | Blink
7 | Reverse video | 8 | Concealed video on
30 | Foreground color: black | 31 | Foreground color: red
32 | Foreground color: green | 33 | Foreground color: yellow
34 | Foreground color: blue | 35 | Foreground color: magenta
36 | Foreground color: cyan | 37 | Foreground color: white
40 | Background color: black | 41 | Background color: red
42 | Background color: green | 43 | Background color: yellow
44 | Background color: blue | 45 | Background color: magenta
46 | Background color: cyan | 47 | Background color: white
| X | X