Control the terminal with escape sequences
ANSI (also called VT100) escape sequences are short byte strings that tell a terminal to move the cursor, clear regions, change text style, switch screen buffers, or set the window title. They all start with the ESC control character. This reference groups the common sequences by purpose and lets you copy each one with the real ESC byte already in place.
How it works
Almost every sequence here is a Control Sequence Introducer: the bytes ESC [
followed by optional numeric parameters and a final letter that selects the
action. For example ESC[{row};{col}H positions the cursor, where {row} and
{col} are 1-based numbers you supply. SGR (Select Graphic Rendition) sequences
like ESC[1m (bold) and ESC[0m (reset) change text appearance. OSC sequences
begin with ESC ] and handle window titles and hyperlinks. When you copy, the
\e placeholder is replaced with the actual ESC byte (0x1B).
Tips and examples
- Clear the screen and home the cursor with
ESC[2JthenESC[H. - Wrap colored output in
ESC[0mat the end so later text is not stained. - In bash use ANSI-C quoting:
printf '\e[1mBold\e[0m\n'. {n}and{row};{col}are parameters you fill in; omitting a number usually defaults it to 1.- OSC 8 hyperlinks let you embed clickable links in supporting terminals without showing the raw URL.