As is often the case with documentation, if you know what you want and you poke around enough,
The original version of this documents has the answer.
As usual, I don't know what it's called so the original was hard (for me) to use, so
I have tried to add some grouping by function.
These sequences are usually implemented in the terminal emulator in the system's BIOS (?) and
are available in DOS, linux console and windows command modes.
In *nix systems, termcap, terminfo and curses are involved in displaying character sequences.
echo $'\e' can be used as the ESC lead in required buy many ANSI terminal control
strings.
ANSI X3.4-1977 defines the 7-bit ASCII character set (C0 and G0). It was written in 1968, revised in 1977, and explains the decisions made in laying out the ASCII code. In particular, it explains why ANSI chose to make ASCII incompatible with EBCDIC in order to make it self-consistant.
ANSI X3.41-1974 introduces the idea of an 8-bit ASCII character set (C1 and G1 in addition to the existing C0 and G0). It describes how to use the 8-bit features in a 7-bit environment. X3.41 defines the format of all ESCape sequences, but defines only the 3-character ones with a parameter character in the middle. These instruct the terminal how to interpret the C0, G0, C1, and G1 characters (such as by selecting different character-set ROMs).
Note: NAPLPS does videotex graphics by redefining the C1 set and selecting alternate G0, G1, G2, and G3 sets. See the February 1983 issue of BYTE magazine for details.
ANSI X3.64-1979 defines the remaining ESCape sequences. It defines all the C1 control characters, and specifies that certain two-character ESCape sequences in the 7-bit environment are to act exactly like the 8-bit C1 control set. X3.64 introduces the idea of a Control-Sequence, which starts with CSI character, has an indefinite length, and is terminated by an alphabetic character. The VT100 was one of the first terminals to implement this standard.
Definitions:
| Control Character | A single character with an ASCII code within the ranges: 000 to 037 and 200 to 237 octal, 00 - 1F and 80 - 9F hex. |
| Escape Sequence | 2 or 3 character string staring with ESCape. (Four or more character strings are allowed but not defined.) |
| Control Sequence | A string starting with CSI (233 octal, 9B hex) or
with ESC[ (Left-Bracket) and terminated by an alphabetic character.Any number of parameter characters (digits 0 to 9, semicolon, and question mark) may appear within the Control Sequence. The terminating character may be preceded by an intermediate character (such as space). |
Character classifications†:
octal| Hex |
| C0 Control |
Note that in this document, the terms uppercase, lowercase, and alphabetics include more characters than just A to Z.
An ESCape Sequence starts with the ESC character (033 octal, 1B hex).
The length of the ESCape Sequence depends on the character that immediately follows the ESCape.
If the next character is:
| C0 control | Interpret the character, then resume processing the sequence. Example: CR, LF, XON, and XOFF work as normal within an ESCape sequence. |
| Intermediate | Expect zero or more intermediates, a parameter terminates a private function, an alphabetic terminates a standard sequence. Example: ESC ( A defines standard character set, ESC ( 0 a DEC set. |
| Parameter | End of a private 2-character escape sequence. Example: ESC = sets special keypad mode, ESC > clears it. |
| Uppercase | Translate it into a C1 control character and act on it. Example: ESC D does indexes down, ESC M indexes up. (CSI is special) |
| Lowercase | End of a standard 2-character escape sequence. Example: ESC c resets the terminal. |
| Delete | Ignore it, and continue interpreting the ESCape sequence C1 and G1: Treat the same as their 7-bit counterparts |
Oct| Hex | control | Name | * marks function used in DEC VT series or LA series terminals
| 000 | 00 | @ | NUL | * | Null filler, terminal should ignore this character
| 001 | 01 | A | SOH | Start of Header
| 002 | 02 | B | STX | Start of Text, implied end of header
| 003 | 03 | C | ETX | End of Text, causes some terminal to respond with ACK or NAK
| 004 | 04 | D | EOT | End of Transmission
| 005 | 05 | E | ENQ | * | Enquiry, causes terminal to send ANSWER-BACK ID
| 006 | 06 | F | ACK | Acknowledge, usually sent by terminal in response to ETX
| 007 | 07 | G | BEL | * | Bell, triggers the bell, buzzer, or beeper on the terminal
| 010 | 08 | H | BS | * | Backspace, can be used to define overstruck characters
| 011 | 09 | I | HT | * | Horizontal Tabulation, move to next predetermined position
| 012 | 0A | J | LF | * | Linefeed, move to same position on next line (see also NL)
| 013 | 0B | K | VT | * | Vertical Tabulation, move to next predetermined line
| 014 | 0C | L | FF | * | Form Feed, move to next form or page
| 015 | 0D | M | CR | * | Carriage Return, move to first character of current line
| 016 | 0E | N | SO | * | Shift Out, switch to G1 (other half of character set)
| 017 | 0F | O | SI | * | Shift In, switch to G0 (normal half of character set)
| 020 | 10 | P | DLE | Data Link Escape, interpret next control character specially
| 021 | 11 | Q | XON | * | (DC1) Terminal is allowed to resume transmitting
| 022 | 12 | R | DC2 | Device Control 2, causes ASR-33 to activate paper-tape reader
| 023 | 13 | S | XOFF | * | (DC2) Terminal must pause and refrain from transmitting
| 024 | 14 | T | DC4 | Device Control 4, causes ASR-33 to deactivate paper-tape reader
| 025 | 15 | U | NAK | Negative Acknowledge, used sometimes with ETX and ACK
| 026 | 16 | V | SYN | Synchronous Idle, used to maintain timing in Sync communication
| 027 | 17 | W | ETB | End of Transmission block
| 030 | 18 | X | CAN | * | Cancel (makes VT100 abort current escape sequence if any)
| 031 | 19 | Y | EM | End of Medium
| 032 | 1A | Z | SUB | * | Substitute (VT100 uses this to display parity errors)
| 033 | 1B | [ | ESC | * | Prefix to an ESCape sequence
| 034 | 1C | \ | FS | File Separator
| 035 | 1D | ] | GS | Group Separator
| 036 | 1E | ^ | RS | * | Record Separator (sent by VT132 in block-transfer mode)
| 037 | 1F | _ | US | Unit Separator
| 040 | 20 | SP | * | Space (should never be defined to be otherwise)
| 177 | 7F | DEL | * | Delete, should be ignored by terminal
| | |||||||||||||||||||||||||
t
e
x
Oct Hex t Name * * marks function used in DEC VT series or LA series terminals)
--- -- - --- - --------------------------------------------------------------
200 80 @ Reserved for future standardization
201 81 A Reserved
202 82 B Reserved
203 83 C Reserved
204 84 D IND * Index, moves down one line same column regardless of NL
205 85 E NEL * NEw Line, moves done one line and to first column (CR+LF)
206 86 F SSA Start of Selected Area to be sent to auxiliary output device
207 87 G ESA End
210 88 H HTS * Horizontal Tabulation Set at current position
211 89 I HTJ Horizontal Tab Justify, moves string to next tab position
212 8A J VTS Vertical Tabulation Set at current line
213 8B K PLD Partial Line Down (subscript)
214 8C L PLU Partial Line Up (superscript)
215 8D M RI * Reverse Index, go up one line, reverse scroll if necessary
216 8E N SS2 * Single Shift to G2 (i.e. alternate graphic rendition)
217 8F O SS3 * Single Shift to G3 (VT100 uses this for sending PF keys)
220 90 P DCS * Device Control String, terminated by ST (VT125 enters graphics)
221 91 Q PU1 Private Use 1
222 92 R PU2 Private Use 2
223 93 S STS Set Transmit State
224 94 T CCH Cancel CHaracter, ignore previous character
225 95 U MW Message Waiting, turns on an indicator on the terminal
226 96 V SPA Start of Protected Area
227 97 W EPA End
230 98 X Reserved for for future standard
231 99 Y Reserved
232 9A Z * Reserved, but causes DEC terminals to respond with DA codes
233 9B [ CSI * Control Sequence Introducer
234 9C \ ST * String Terminator (VT125 exits graphics)
235 9D ] OSC Operating System Command (reprograms intelligent terminal)
236 9E ^ PM Privacy Message (password verification), terminated by ST
237 9F _ APC Application Program Command (to word processor), term by ST
Character set selection sequences
(from ANSI X3.41-1974)
All are 3 characters long (including the ESCape).
Alphabetic characters as 3rd character are defined by ANSI,
parameter characters as 3rd character may be interpreted differently by each terminal manufacturer.
The symbol ‡ indicates sequences suopported by linux TERM=ansi
t
e
x
Oct Hex t example x'
1B2330' ESC #3 set DoubleHeight top half (send bottom half next)
--- -- -- - ------------------------------------------------------------------
040 20 ANNOUNCER - Determines whether to use 7-bit or 8-bit ASCII
A G0 only will be used. Ignore SI, SO, and G1. (Graphic characters)
B G0 and G1 used internally. SI and SO affect G0, Ignore G1
C G0 and G1 in an 8-bit only environment. Ignore SI and SO
D G0 and G1 are used, SI and SO affect G0.
E
F * 7-bit transmission, VT240/PRO350 sends CSI as two characters ESC [
G * 8-bit transmission, VT240/PRO350 sends CSI as single 8-bit character
041 21 ! Select C0 control set (choice of 63 standard, 16 private)
042 22 " Select C1 control set (choice of 63 standard, 16 private)
043 23 # Translate next character to a special single character
#3 * DECDHL1 - Double height line, top half
#4 * DECDHL2 - Double height line, bottom half
echo $'\e'#3abcdefg; echo $'\e'#4abcdefg
#5 * DECSWL - Single width line
#6 * DECDWL - Double width line
abcdefg
echo $'\e'#5bcdefg;
#7 * DECHCP - Make a hardcopy of the graphics screen (GIGI,VT125,VT241)
#8‡* DECALN - Alignment display, fill screen with "E" to adjust focus
044 24 $ MULTIBYTE CHARACTERS - Displayable characters require 2-bytes each
045 25 % SPECIAL INTERPRETATION - Such as 9-bit data
046 26 & Reserved for future standardization
047 27 ' Reserved for future standardization
050 28 ( * SCS - Select G0 character set (choice of 63 standard, 16 private)
(0 * DEC VT100 line drawing set (affects lowercase characters)
(1 * DEC Alternate character ROM set (RAM set on GIGI and VT220)
echo $'\e'#6bcdefg;
abcdefg
(2 * DEC Alternate character ROM set with line drawing
(5 * DEC Finnish on LA100
(6 * DEC Norwegian/Danish on LA100
(7 * DEC Swedish on LA100
(9 * DEC French Canadian
(< * DEC supplemental graphics (everything not in USASCII)
(A * UKASCII (British pound sign)
(B * USASCII (American pound sign)
(C * ISO Finnish on LA120
(E * ISO Norwegian/Danish on LA120
(H * ISO Swedish on LA120
(K * ISO German on LA100,LA120
(R * ISO French on LA100,LA120
(Y * ISO Italian on LA100
(Z * ISO Spanish on LA100
051 29 ) * SCS - Select G1 character set (choice of 63 standard, 16 private)
* (same character sets as listed under G0)
052 2A * * SCS - Select G2 character set
* (same character sets as listed under G0)
053 2B + * SCS - Select G3 character set
* (same character sets as listed under G0)
054 2C , SCS - Select G0 character set (additional 63+16 sets)
055 2D - SCS - Select G1 character set (additional 63+16 sets)
056 2E . SCS - Select G2 character set
057 2F / SCS - Select G3 character set
▒␉␌␍␊°±␋┘┐┌└╋-_-_-_┣┫┻┳
ABCDEFGHIJKLMNOPQRSTUVWXYZ0
Private two-character escape sequences (allowed by ANSI X3.41-1974)
These can be defined differently by each terminal manufacturer.
Oct Hex
--- -- - - ------------------------------------------------------------------
060 30 0
061 31 1 DECGON graphics on VT105, DECHTS horiz tab set for LA34/LA120
062 32 2 DECGOFF graphics off VT105, DECCAHT clear all horz tabs LA34/LA120
063 33 3 DECVTS - set vertical tab for LA34/LA120
064 34 4 DECCAVT - clear all vertical tabs for LA34/LA120
065 35 5 * DECXMT - Host requests that VT132 transmit as if ENTER were pressed
066 36 6
067 37 7 * DECSC - Save cursor position and character attributes
070 38 8 * DECRC - Restore cursor and attributes to previously saved position
071 39 9
072 3A :
073 3B ;
074 3C < * DECANSI - Switch from VT52 mode to VT100 mode
075 3D * DECKPAM - Set keypad to applications mode (ESCape instead of digits)
076 3E > * DECKPNM - Set keypad to numeric mode (digits intead of ESCape seq)
077 3F ?
DCS Device Control Strings used by DEC terminals (ends with ST)
Pp Start ReGIS graphics (VT125, GIGI, VT240, PRO350)
Pq Start SIXEL graphics (screen dump to LA34, LA100, screen load to VT125)
Pr SET-UP data for GIGI, $PrVC0$\ disables both visible cursors.
Ps Reprogram keys on the GIGI, $P0sDIR<<CR>$\ makes keypad 0 send "DIR<CR>"
0-9=digits on keypad, 10=ENTER, 11=minus, 12=comma, 13=period,
14-17=PF1-PF4, 18-21=cursor keys. Enabled by $[?23h (PK1).
Pt Start VT105 graphics on a VT125
Standard two-character escape sequences (defined by ANSI X3.64-1979)
100 40 @ See description of C1 control characters
An ESCape followed by one of these uppercase characters is translated
to an 8-bit C1 control character before being interpreted.
220 90 P DCS - Device Control String, terminated by ST - see table above.
133 5B [ CSI - Control Sequence Introducer
137 5F _ See description of C1 control characters
Indepenent control functions (from Appendix E of X3.64-1977).
These four controls have the same meaning regardless of the current definition of the C0 and C1 control sets.
Each control is a two-character ESCape sequence, the 2nd is lowercase.
Oct Hex * (* marks function used in DEC VT series or LA series terminals)
--- -- - - --------------------------------------------------------------------
140 60 ` DMI - Disable Manual Input
141 61 a INT - INTerrupt the terminal and do special action
142 62 b EMI - Enable Manual Input
143 63 c * RIS - Reset to Initial State (VT100 does a power-on reset)
... The remaining lowercase characters are reserved by ANSI.
153 6B k NAPLPS lock-shift G1 to GR
154 6C l NAPLPS lock-shift G2 to GR
155 6D m NAPLPS lock-shift G3 to GR
156 6E n * LS2 - Shift G2 to GL (extension of SI) VT240,NAPLPS
157 6F o * LS3 - Shift G3 to GL (extension of SO) VT240,NAPLPS
... The remaining lowercase characters are reserved by ANSI.
174 7C | * LS3R - lock-shift G3 to GR VT240
175 7D } * LS2R - lock-shift G2 to GR VT240
176 7E ~ * LS1R - lock-shift G1 to GR VT240
Control Sequences (defined by ANSI X3.64-1979)
Parameter characters are ESC[ (CSI) and terminated by an alphabetic character (100 to 176 octal, 40 to 7E hex).
/ (40 to 57 octal, 20 to 2F hex)
0 ? (60 to 77 octal, 30 to 3F hex, including digits and semicolon).
Parameters consist of zero or more decimal numbers separated by semicolons.
Leading zeros are optional, leading blanks are not allowed.
If no digits precede the final character, the default parameter is used.
Many functions treat a parameter of 0 as if it were 1.
*nix shell command: echo $'\e' can be used as the ESC lead-in required by many ANSI terminal control
Oct Hex * (* marks function used in DEC VT series or LA series terminals)
Private Control Sequences (allowed by ANSI X3.41-1974).
These take parameter strings and terminate with the last half of lowercase.
Oct Hex
--- -- - - --------------------------------------------------------------------
160 70 p * DECSTR - Soft Terminal Reset
ESC[!p Soft Terminal Reset
161 71 q * DECLL - Load LEDs
‡ [0q Turn off all, [1;4q turns on L1 and L4, (Linux supports L1 as scroll lock, L2 NumLock,
L3 as Caps lock , )
[154;155;157q VT100 goes bonkers
[2;23!q Partial screen dump from GIGI to graphics printer
[0"q DECSCA Select Character Attributes off
[1"q DECSCA - designate set as non-erasable
[2"q DECSCA - designate set as erasable
162 72 r * DECSTBM - Set top and bottom margins (scroll region on VT100)
[4;20r Set top margin at line 4 and bottom at line 20
163 73 s * DECSTRM - Set left and right margins on LA100,LA120
[5;130s Set left margin at column 5 and right at column 130
164 74 t * DECSLPP - Set physical lines per page
[66t Paper has 66 lines (11 inches at 6 per inch)
165 75 u * DECSHTS - Set many horizontal tab stops at once on LA100
[9;17;25;33;41;49;57;65;73;81u Set standard tab stops
166 76 v * DECSVTS - Set many vertical tab stops at once on LA100
[1;16;31;45v Set vert tabs every 15 lines
167 77 w * DECSHORP - Set horizontal pitch on LAxxx printers
[1w 10 characters per inch, [2w = 12 characters per inch
[0w=10, [3w=13.2, [4w=16.5, [5w=5, [6w=6, [7w=6.6, [8w=8.25
170 78 x * DECREQTPARM - Request terminal parameters
[3;5;2;64;64;1;0x Report, 7 bit Even, 1200 baud, 1200 baud
171 79 y * DECTST - Invoke confidence test
[2;1y Power-up test on VT100 series (and VT100 part of VT125)
[3;1y Power-up test on GIGI (VK100)
[4;1y Power-up test on graphics portion of VT125
172 7A z * DECVERP - Set vertical pitch on LA100
[1z 6 lines per inch, [2z = 8 lines per inch
[0z=6, [3z=12, [4z=3, [5z=3, [6z=4
173 7B { Private
174 7C | * DECTTC - Transmit Termination Character
[0| No extra characters, [1| = terminate with FF
175 7D } * DECPRO - Define protected field on VT132
[0} No protection, [1;4;5;7} = Any attribute is protected
[254} Characters with no attributes are protected
176 7E ~ * DECKEYS - Sent by special function keys
[1~=FIND, [2~=INSERT, [3~=REMOVE, [4~=SELECT, [5~=PREV, [6~=NEXT
[17~=F6...[34~=F20 ([23~=ESC,[24~=BS,[25~=LF,[28~=HELP,[29~=DO)
177 7F DELETE is always ignored
Oct Hex
--- -- - - --------------------------------------------------------------------
100 40 @ SL - Scroll Left
[4 @ Move everything over 4 columns, 4 new columns at right
101 41 A SR - Scroll Right
[2 A Move everything over 2 columns, 2 new columns at left
102 42 B GSM - Graphic Size Modification
[110;50 B Make 110% high, 50% wide
103 43 C GSS - Graphic Size Selection
[120 C Make characters 120 decipoints (1/6 inch) high
104 44 D FNT - FoNT selection (used by SGR, [10m thru [19m)
[0;23 D Make primary font be registered font #23
105 45 E TSS - Thin Space Specification
[36 E Define a thin space to be 36 decipoints (1/20 inch)
106 46 F JFY - JustiFY, done by the terminal/printer
[0 E No justification
[1 E Fill, bringing words up from next line if necessary
[2 E Interword spacing, adjust spaces between words
[3 E Letter spacing, adjust width of each letter
[4 E Use hyphenation
[5 E Flush left margin
[6 E Center following text between margins (until [0 E)
[7 E Flush right margin
[8 E Italian form (underscore instead of hyphen)
107 47 G SPI - SPacing Increment (in decipoints)
[120;72 G 6 per inch vertical, 10 per inch horizontal
110 48 H QUAD- Do quadding on current line of text (typography)
[0 H Flush left, [1 H Flush left and fill with leader
[2 H Center, [3 H Center and fill with leader
[4 H Flush right, [5 H Flush right and fill with leader
111 49 I Reserved for future standardization
157 67 o Reserved for future standardization
160 70 p Private use
..71-7D. May be defined by the printer manufacturer
176 7E ~ Private use
177 7F DELETE is always ignored
|
Minimum requirements for VT100 emulation:
|