From: Colin_Douthwaite-at-equinox.gen.nz (Colin
Douthwaite)
Date: Wed Jan 26 12:06:50 CST 1994
ANSI ESCAPE SEQUENCES
| ESC code sequence | Function |
|---|---|
| Wherever you see '#', that should be replaced by the appropriate number. | |
| Cursor Controls: | |
| ESC[#;#H or ESC[#;#f | Moves cusor to line #, column # |
| ESC[#A | Moves cursor up # lines |
| ESC[#B | Moves cursor down # lines |
| ESC[#C | Moves cursor forward # spaces |
| ESC[#D | Moves cursor back # spaces |
| ESC[#;#R | Reports current cursor line & column |
| ESC[s | Saves cursor position for recall later |
| ESC[u | Return to saved cursor position |
| Erase Functions: | |
| ESC[2J | Clear screen and home cursor |
| ESC[K | Clear to end of line |
| Set Graphics Rendition: | |
| ESC[#;#;....;#m |
Set display attributes where # is
|
| ESC[=#;7h or
ESC[=h or ESC[=0h or ESC[?7h |
Put screen in indicated mode where # is
|
| ESC[=#;7l or
ESC[=l or ESC[=0l or ESC[?7l |
Resets mode # set with above command |
| Keyboard Reassignments: | |
| ESC[#;#;...p or
ESC["string"p or ESC[#;"string";#;#;"string";#p |
Keyboard reassignment. The first ASCII code defines which code is to be changed. The remaining codes define what it is to be changed to. |
| E.g. Reassign the Q and q keys to the A and a keys (and vice versa). | |
| ESC [65;81p | A becomes Q |
| ESC [97;113p | a becomes q |
| ESC [81;65p | Q becomes A |
| ESC [113;97p | q becomes a |
| E.g. Reassign the F10 key to a DIR command. | |
| ESC [0;68;"dir";13p | The 0;68 is the extended ASCII code for the F10 key and 13 is the ASCII code for a carriage return. |
| Other function key codes | F1=59, F2=60, F3=61, F4=62, F5=63, F6=64, F7=65, F8=66, F9=67, F10=68 |