ANSI standards for ASCII terminals

Joe Smith, 18-May-84, With additions by Dennis German
OFFICIAL ANSI X3.64-1979

These sequences are usually implemented in the terminal emulator in the system's BIOS (?) and are available in DOS, £inux console, windows command modes and mac os terminal.
In *nix systems, termcap, terminfo and curses are involved in displaying character sequences.

In this document the symbol £ indicates sequences supported by £inux TERM=ansi
From the bash command line echo $'\e' outputs the lead-in required by many ANSI terminal control strings.

  1. Overview and Definitions
  2. General rules for interpreting an ESCape Sequence
  3. General rules for interpreting a Control Sequence
  4. C0 and C1 control codes in numeric order
  5. Two and three-character ESCape Sequences in numeric order
  6. Control Sequences in numeric order
  7. VT100 emulation requirements
  8. Set Graphic Rendition
  9. Character set selection sequences

Definitions:

    Control Character A single character with an ASCII code within the ranges: 00-1F and 80-9F .
    Escape Sequence 2 or 3 character string staring

    Control Sequence

    A string starting with CSI ( 9B ) or with [ (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
    range
    Hex
    range
     
    C0 Control 000-037 00-1F (G0 is 041-176 octal, 21-7E hex)
     SPACE 040+240 20 & A0
     Intermediate 040-057 20-2F !"#$%&'()*+,-./
     Parameters 060-077 30-3F 0123456789:;<=>
     Alphabetic 100-176 40-7E (all of upper and lower case)
      Uppercase 100-137 40-5F @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
      Lowercase 140-176 60-7E `abcdefghijlkmnopqrstuvwxyz{|}~
     Delete 177 7F ignored
    C1 Control 200-237 80-9F (lead in with ) 32 additional control characters
    G1 Displayable 241-376 A1-FE 94 additional displayable characters
    Special 240 & 377 A0 & FF Same as SPACE and DELETE

    In this document, the terms uppercase, lowercase, and alphabetics include more characters than just A to Z.

    ESCape Sequence

    Starts with the character ( 1B hex).
    The length depends on the character that immediately follows the .
    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: (A defines standard character set, (0 a DEC set.
    Parameter End of a private 2-character escape sequence.
    Example: = sets special keypad mode, > clears it.
    Uppercase Translate it into a C1 control character and act on it.
    Example: D does indexes down, M indexes up. (CSI is special)
    Lowercase End of a standard 2-character escape sequence.
    Example: c resets the terminal.
    Delete Ignore it, and continue interpreting the ESCape sequence
    C1 and G1: Treat the same as their 7-bit counterparts

    Control Sequence

    1. Starts with CSI, the Control Sequence Introducer. the C0 two-character sequence ESC[ or the 8-bit C1 code [.
    2. Contains any number of parameter characters (0123456789:;<=>?).
    3. Terminates with an alphabetic character.
    4. Intermediate characters may precede the terminator.
    The terminal should expect any number of numeric parameters, separated by semicolons ( 3B ).
    Only after the terminating alphabetic character is received should the terminal act on the Control Sequence.


    C0 set of 7-bit control characters

    (from ANSI X3.4-1977)
    OctHex controlName * functions used in DEC VT series or LA series terminals
    00000@NUL* Null filler
    00101ASOH Start of Header
    00202BSTX Start of Text, implied end of header
    00303CETX End of Text, respond with ACK or NAK
    00404DEOT End of Transmission
    00505EENQ* Enquiry, ANSWER-BACK ID
    (load answerback esc^mmmmmCTRLY; not £inux)
    00606FACK Acknowledge, response to ETX
    00707GBEL* Bell
    01008HBS* Backspace
    01109IHT* Horizontal Tabulation, move to next TAB position
    0120AJLF* Linefeed, move to same position on next line (see also NL)
    0130BKVT* Vertical Tabulation, move to next predetermined line
    0140CLFF* Form Feed, slew to next form or page
    0150DMCR* Carriage Return, move to first character of current line
    0160ENSO* Shift Out, switch to G1 (other half of character set)
    0170FOSI* Shift In  , switch to G0 (normal half of character set)
    02010PDLE Data Link Escape, interpret next control character specially
    02111QXON* (DC1) resume transmitting
    02212RDC2 (DC2) activate reader
    02313SXOFF*(DC3) pause transmitting
    02414TDC4 (DC4) deactivate reader
    02515UNAK Negative Acknowledge, with ETX and ACK
    02616VSYN Synchronous Idle, maintain timing in Sync communication
    02717WETB End of Transmission block
    03018XCAN* Cancel abort current escape sequence
    03119YEM End of Medium
    0321AZSUB* Substitute (Display parity errors)
    0331B[ESC* Prefix to an ESCape sequence
    0341C\FS File Separator
    0351D]GS Group Separator
    0361E^RS* Record Separator (sent by VT132 in block-transfer mode)
    0371F_US Unit Separator
    04020SP* Space
    1777FDEL* Delete, ignored by terminal
    If the first character after CSI is one of " < = > (3C-3F ), it is to be interpreted according to private standards (such as setting and resetting modes not defined by ANSI).

    C1 set of 8-bit control characters (from ANSI X3.64-1979)

    Lead in with ESC -->
    usual graphic
            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 same column regardless of NL
    205 85  E NEL *  New Line, moves dowe 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(i.e. next character) 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  SOS       Reserved for for future standard (Start of string)
    231  99  Y            Reserved
    232 9A  Z     *  DECID   (response VT102:ESC [ ? 6 c 
    233 9B  [ CSI *  Control Sequence Introducer 
    234 9C  \ ST  *  String Terminator (VT125 exits graphics)
    235 9D  ] OSC£inux   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
    
    £inux 
    ESC]0            Operating System Command
    ESC]0;stringBEL  Set icon name and window title to string 
    ESC]1;stringBEL  Set icon name to string 
    ESC]2;stringBEL  Set window title to string
    ESC]P nrrggbb   
    ESC]R                       reset palette
    
    
    

    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.
            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
            L   ANSI conformance level 1
            M                          2 dpANS x3.134.1
            N                          3
    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 ( OK on Mac os in terminal) abcdefg
    #5 * DECSWL - Single width line #6 * DECDWL - Double width line
    echo $'\e'#5bcdefg; echo $'\e'#6bcdefg; abcdefg
    #7 * DECHCP - Make a hardcopy of the graphics screen (GIGI,VT125,VT241) #8£* DECALN - Alignment display, fill screen with "E" to adjust focus EEEEE 044 24 $ MULTIBYTE CHARACTERS - Displayable characters require 2-bytes each 045 25 % SPECIAL INTERPRETATION - Such as 9-bit data % Start sequence selecting character set (£) % @ Select default (ISO 646 / ISO 8859-1) % G Select UTF-8 % 8 Select UTF-8 (obsolete) 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)
    ▒␉␌␍␊°   ±␤␋┘┐┌└╋-_-_-_┣┫┻┳    £inux
    abcdef   ghijklmnopqrstuvwxyz0|}
    
    (2 * DEC Alternate character ROM set with line drawing (5 * DEC Finnish on LA100 (C * ISO Finnish on LA120 (6 * DEC Norwegian/Danish on LA100 (E * ISO Norwegian/Danish on LA120 (7 * DEC Swedish on LA100 (H * ISO Swedish on LA120 (9 * DEC French Canadian (R * ISO French on LA100,LA120 (< * DEC supplemental graphics (everything not in USASCII) (A * UKASCII (British pound sign) (B * USASCII (American pound sign) (K * ISO German on LA100,LA120 (Y * ISO Italian on LA100 (Z * ISO Spanish on LA100 (< * DEC supplementary char set VT200 £inux ( B Select default (ISO 8859-1 mapping) ( 0 Select VT100 graphics mapping ( U Select null mapping - straight to character ROM ( K Select user mapping - the map that is loaded by the utility mapscrn(8). 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
    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   DECBI  - back index
    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   DECFI   - forwared index
    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.
    133 5B [ CSI - Control Sequence Introducer 
    
    136 5E ] OSC  (£inux  Operating system command) 
                ]P nrrggbb: set palette, with parameter given in 7 hex digits 
                        n is the color (0-15), and rrggbb indicates the red/green/blue values (0-255).  
                ]R: reset palette
    137 5F _ See description of C1 control characters
    220 90 P DCS - Device Control String, terminated by ST - see table above.
    

    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)

    *nix shell command: echo $'\e' can be used as the ESC lead-in required by many ANSI terminal control
    Oct Hex
    100 40 @ ICH Insert CHaracter [10@ Make room for 10 characters at current position
    101 41 A CUU CUrsor Up * £[A move up one line, stop at top of screen, [9A = move up 9
    102 42 B CUD CUrsor Down * £ [B move down one line, stop at bottom of screen
    103 43 C CUF CUrsor Forward * £ [C move forward one position, stop at right edge of screen
    104 44 D CUB CUrsor Backward * £ [D Same as BackSpace, stop at left edge of screen
    105 45 E CNL Cursor to Next Line £ [5E move to first position of 5th line down
    106 46 F CPL Cursor to Previous Line £ [5F move to first position of 5th line previous
    107 47 G CHA Cursor Horizontal position Absolute £[40G move to column 40 of current line
    110 48 H CUP CUrsor Position * £[H Home, [24;80H = Row 24, Column 80
    111 49 I CHT Cursor Horizontal Tabulation[I as HT (Control-I)not linux, [3I = Go forward 3 tabs
    112 4A J ED erase in Display (cursor does not move)* £ [J [0J = erase from current position to end (inclusive) [1J erase from beginning to current position (inclusive) [2J erase entire display [3J ~erase whole display including scroll-back buffer(£) [?0J Selective erase in display ([?1J, [?2J similar)
    113 4B K EL - erase in Line (cursor does not move) * £ [K [0K = erase from current position to end (inclusive) [1K erase from beginning to current position [2K erase entire current line [?0K Selective erase to end of line ([?1K, [?2K similar)
    114 4C L * IL Insert Line, current line moves down (VT102 series)£ [3L Insert 3 lines if currently in scrolling region
    115 4D M * DL Delete Line, lines below current move up (VT102 series)£ [2M Delete 2 lines if currently in scrolling region
    116 4E N EF erase in Field (as bounded by protected fields)[0N, [1N, [2N act like [L but within currend field
    117 4F O EA erase in qualified Area (defined by DAQ)[0O, [1O, [2O act like [J but within current area
    120 50 P * DCH Delete Character, from current position to end of field [4P Delete 4 characters, VT102 series
    121 51 Q SEM Set Editing extent Mode (limits ICH & DCH)[0Q [Q = Insert/delete character affects rest of display [1Q ICH/DCH affect the current line only [2Q ICH/DCH affect current field (between tab stops) only [3Q ICH/DCH affect qualified area (between protected fields)
    122 52 R * CPR Cursor Position Report (from terminal to host) *[24;80R Cursor is positioned at line 24 column 80
    123 53 S SU Scroll up, entire display is moved up, new lines at bottom[3S move everything up 3 lines, bring in 3 new lines
    124 54 T SD Scroll down, new lines inserted at top of screen[4T Scroll down 4, bring previous lines back into view
    125 55 U NP Next Page (if terminal has more than 1 page of memory) [2U Scroll forward 2 pages
    126 56 V PP Previous Page (if terminal remembers lines scrolled off top) [1V Scroll backward 1 page
    127 57 W CTC Cursor Tabulation Control [0W Set horizontal tab for current line at current position [1W Set vertical tab stop for current line of current page
    [2W Clear horiz tab stop at current position of current line
    [3W Clear vert tab stop at current line of current page
    [4W Clear all horiz tab stops on current line only
    [5W Clear all horiz tab stops for the entire terminal
    [6W Clear all vert tabs stops for the entire terminal
    130 58 X ECH erase CHaracter [4X Change next 4 characters to "erased" state
    131 59 Y CVT Cursor Vertical Tab [2Y move forward to 2nd following vertical tab stop
    132 5A Z CBT Cursor Back Tab [3Z move backwards to 3rd previous horizontal tab stop
    133 5B [ Reserved for future standardization
    134 5C \ Reserved
    135 5D ] Reserved
    136 5E ^ Reserved
    137 5F _ Reserved

    140 60 ` * HPA Horizontal Position Absolute (depends on PUM) [720` move to 720 decipoints (1 inch) from left margin
    [80` move to column 80 on LA120
    141 61 a * HPR Horizontal Position Relative(depends on PUM) [360a move 360 decipoints (1/2 inch) from current position
    [40a move 40 columns to right of current position on LA120
    142 62 b REP REPeat previous displayable character [nnb Repeat character following b nn times £
    143 63 c * DA Device Attributes [c Terminal will identify itself (Does not prevent disconnect!)
    £ ansi reports 6c
    [?1;2c Terminal is saying it is a VT100 with AVO
    [>0c Secondary DA request (distinguishes VT240 from VT220)
    144 64 d * VPA Vertical Position Absolute(depends on PUM) [90d move to 90 decipoints (1/8 inch) from top margin [10d move to line 10 if before that else line 10 next page
    145 65 e * VPR Vertical Position Relative(depends on PUM) [720e move 720 decipoints (1 inch) down from current position
    [6e Advance 6 lines forward on LA120
    146 66 f * HVP Horizontal and Vertical Position(depends on PUM) [720,1440f move to 1 inch down and 2 inches over (decipoints)
    [24;80f move to row 24 column 80 if PUM is set to character
    147 67 g * TBC - Tabulation Clear[0g Clear horizontal tab stop at current position [1g Clear vertical tab stop at current line (LA120)
    [2g Clear all horizontal tab stops on current line only LA120
    [3g Clear all horizontal tab stops in the terminal
    150 68 h * SM - Set Mode ( l
    [0h Error, ignored
    [1h GATM Guarded Area Transmit Mode, send all (VT132)
    [2h KAM Keyboard Action Mode, disable keyboard input
    xterm Bracketed Paste Mode: pasted text is bracketed with control sequences
    so that the program can differentiate pasted text from typed- in text.
    When bracketed paste mode is set, the program will receive:

    ESC [ 2 0 0 ~ ,
    followed by the pasted text, followed by ESC [ 2 0 1 ~ .
    For background and discussion, see the FAQ:

    [3h CRM Control Representation Mode, show all control chars
    [4h IRM Insertion/Replacement Mode, set insert mode (VT102)
    [5h SRTM Status Report Transfer Mode, report after DCS
    [6h ERM ERasure Mode, erase protected and unprotected
    [7h VEM Vertical Editing Mode, IL/DL affect previous lines
    [8h reserved
    [9h reserved
    [10h HEM Horizontal Editing mode, ICH/DCH/IRM go backwards
    [11h PUM Positioning Unit Mode, use decipoints for HVP/etc
    [12h SRM Send Receive Mode, transmit without local echo
    [13h FEAM Format Effector Action Mode, FE's are stored
    [14h FETM Format Effector Transfer Mode, send only if stored
    [15h MATM Multiple Area Transfer Mode, send all areas
    [16h TTM Transmit Termination Mode, send scrolling region
    [17h SATM Send Area Transmit Mode, send entire buffer
    [18h TSM Tabulation Stop Mode, lines are independent
    [19h EBM Editing Boundry Mode, all of memory affected
    [20h LNM Linefeed Newline Mode, LF interpreted as CR LF

    [?1h DECCKM Cursor Keys Mode, send ESC O A for cursor up
    [?2h DECANM ANSI Mode, use ESC < to switch VT52 to ANSI
    [?3h DECCOLM COLumn mode, 132 characters per line
    [?4h DECSCLM SCrolL Mode, smooth scrolling
    [?5h DECSCNM ScreeN Mode, white on black background
    [?6h DECOM Origin Mode, line 1 is relative to scroll region
    [?7h DECAWM AutoWrap Mode, start newline after column 80
    [?8h DECARM Auto Repeat Mode, key will autorepeat
    [?9h DECINLM INterLace Mode, interlaced for taking photos
    [?10h DECEDM EDit Mode, VT132 is in EDIT mode
    [?11h DECLTM Line Transmit Mode, ignore TTM, send line
    [?12h ?
    [?13h DECSCFDM Space Compression/Field Delimiting on,
    [?14h DECTEM Transmit Execution Mode, transmit on ENTER
    [?15h ?
    [?16h DECEKEM Edit Key Execution Mode, EDIT key is local
    [?17h ?
    [?18h DECPFF Print FormFeed mode, send FF after printscreen
    [?19h DECPEXT Print Extent mode, print entire screen
    [?20h OV1 Overstrike, overlay characters on GIGI
    [?21h BA1 Local BASIC, GIGI to keyboard and screen
    [?22h BA2 Host BASIC, GIGI to host computer
    [?23h PK1 GIGI numeric keypad sends reprogrammable sequences
    [?24h AH1 Autohardcopy before erasing or rolling GIGI screen
    [?25h ??? show cursor
    [?29h- Use only the proper pitch for the LA100 font

    [?38h DECTEK TEKtronix mode graphics

    Mac OS terminal specials:
    [? 1004 h Enable reporting focus. Reports when terminal emulator enters/exits focus
    as ESC [I and ESC [O.
    (Causes mac os terminal to "alert" when gaining/loosing focus)
    [? 1049 h Enable alternative screen buffer, from xterm
    [? 2004 h Turn on bracketed paste mode.
    [34] In bracketed paste mode, text pasted into the terminal will be surrounded
    by ESC [200~ and ESC [201~; programs running in the terminal should not treat characters bracketed by those sequences as commands
    (Vim, for example, does not treat them as commands).
    [35] From xterm[36]
    [?2004h
    [?1004h focus notify disable
    [?2004h

    151 69 i *

    [1i Transmit only unprotected characters (VT132) GATM
    [2i Enable input from keyboard KAM






    [3i Control characters are not displayable characters CRM
    [4i Reset to replacement mode (VT102) IRM
    [5i Report only on command (DSR) SRTM
    [6i erase only unprotected fields ERM
    [7i IL/DL affect lines after current line VEM
    [8i reserved
    [9i reserved
    [10i ICH and IRM shove characters forward, DCH pulls HEM
    [11i Use character positions for HPA/HPR/VPA/VPR/HVP PUM
    [12i Local echo - input from keyboard sent to screen SRM
    [13i HPA/VPA/SGR/etc are acted upon when received FEAM
    [14i Format Effectors are sent to the printer FETM
    [15i Send only current area if SATM is reset MATM
    [16i Transmit partial page, up to cursor position TTM
    [17i Transmit areas bounded by SSA/ESA/DAQ SATM
    [18i Setting a tab stop on one line affects all lines TSM
    [19i Insert does not overflow to next page EBM
    [20i Linefeed does not change horizontal position LNM

    [?1i Cursor keys send ANSI cursor position commands DECCKM
    [?2i Use VT52 emulation instead of ANSI mode DECANM
    [?3i 80 characters per line (erases screen) DECCOLM
    [?4i Jump scrolling DECSCLM
    [?5i black on white background) DEC SCNM
    [?6i Line numbers are independent of scrolling region DECOM
    [?7i Cursor remains at end of line after column 80 DECAWM
    [?8i Keys do not repeat when held down DECARM
    [?9i Display is not interlaced to avoid flicker DECINLM
    [?10i VT132 transmits all key presses DECEDM
    [?11i Send page or partial page depending on TTM DECLTM
    [?12i
    [?13i Don't suppress trailing spaces on transmit DECSCFDN
    [?14i ENTER sends ESC S (STS) a request to send DECTEM
    [?15i
    [?16i EDIT key transmits either $[10h or $[10l DECEKEM
    [?17i
    [?18i Don't send a formfeed after printing screen DECPFF
    [?19i Print only the lines within the scroll region DECPEXT
    [?20i OV0 Space is destructive, replace not overstrike, GIGI OV0
    [?21i BA0 No BASIC, GIGI is On-Line or Local BA0
    [?22i BA0 No BASIC, GIGI is On-Line or Local BA0
    [?23i PK0 Ignore reprogramming on GIGI keypad and curso PK0rs
    [?24i AH0 No auto-hardcopy when GIGI screen erased AH0
    [?25i ??? hide cursor
    [?29i Allow all character pitches on the LA100

    [?38i Ignore TEKtronix graphics commands


    151 69 i * MC -> Media Copy
    (printer port on VT102)
    [0i Send contents of text screen to printer
    [1i Fill screen from auxiliary input (printer's keyboard)
    [2i Send screen to secondary output device
    [3i Fill screen from secondary input device
    [4i Turn on copying received data to primary output (VT125)
    [4i Received data goes to VT102 screen, not to its printer
    [5i Turn off copying received data to primary output (VT125)
    [5i Received data goes to VT102's printer, not its screen
    [6i Turn off copying received data to secondary output (VT125)
    [7i Turn on copying received data to secondary output (VT125)
    [?0i Graphics screen dump goes to graphics printer VT125,VT240
    [?1i Print cursor line, terminated by CR LF
    [?2i Graphics screen dump goes to host computer VT125,VT240
    [?4i Disable auto print
    [?5i Auto print, send a line at a time when linefeed received

    152 6A j PageFormatSelect
    sysworks.biz DEC book

    [0j Portrait Normal text N. American letter No
    [1j Landscape Normal text N. American letter No
    [2j Portrait Normal A4 No
    [3j Landscape Normal A4 No
    [4j Portrait Normal N. American letter No
    [5j Landscape Normal N. American letter No
    [6j Portrait Extended A4 No
    [7j Landscape Extended A4 No
    [8j Portrait Extended Legal No
    [9j Landscape Extended Legal No
    [?20j Portrait Extended N. American letter Yes
    [?21j Landscape Extended N. American letter Yes
    [?22j Portrait Extended A4 Yes
    [?23j Landscape Extended A4 Yes
    [?24j Portrait Extended Legal Yes
    [?25j Landscape Extended Legal Yes
    [?26j Portrait Extended B Yes
    [?27j Landscape Extended B Yes

    Normal sets PageHome 1/2 inch below top margin and
    PageEnd 5/6 inch above bottom margin

    Extended PageHome at top margin
    PageEnd at bottom margin
    text format printable area is 3/10 in. (2160 centipoints) narrower than normal
    N. American letter format
    153 6B k Reserved for future standardization


    154 6C l * RM Reset Mode ( permanently reset on VT100)

    See Set Mode [xh

    [? 1004 l Disable reporting focus
    [? 1049 l Disable alternative screen buffer, from xterm.
    [? 2004 l Turn off bracketed paste mode
    .

    155 6D m * SGR Set Graphics Rendition based on parameter
                                            (affects character attributes)

    [0m Clear all special attributes
    [1m Bold or increased intensity
    To produce:  --warning: not network connection i.e. bold

    echo  $'\e'\[1m --warning: not network connection  $'\e'\[0m
          ^^^^^
           esc 
    Change a section of output(from log to end of line) to bold:
    … |sed --unbuffered "s/log/&$\e[1m/; s/$/'\e[0m/"
    [2X cancels X attribute (except bold)
    [2m dim or secondary color on GIGI (superscript on XXXXXX)
    [22m Cancel bold or dim attribute (VT220)

    [3m Italic (subscript on XXXXXX)
    [23m cancel Italic

    [4m Underscore, $'\e[0;4m' = Clear, then set underline only
    [24m Cancel underline attribute only (VT220)

    [5m Slow blink
    [6m Fast blink ( not on Mac OS terminal) (overscore on XXXXXX)
    [25m Cancel fast or slow blink attribute only (VT220)

    Bold, italic, underscore and bink rate may be combined

    [7m Negative image
    [1;7m = Bold + Inverse
    [27m Cancel negative image attribute only (VT220)

    [8m Concealed (do not display character echoed locally)
    [9m Reserved for future standardization
    [10m Select primary font (LA100)
    [11m Selete alternate font (LA100 has 11 thru 14)
    [19m
    [20m
    FRAKTUR 26 characters include β, umlauts...

    -foreground- -background-
    [30m black [40m red 
    [31m red [41m red 
    [32m green [42m green 
    [33m yellow [43m yellow 
    [34m blue [44m blue 
    [35m magenta [45m magenta 
    [36m cyan [46m cyan 
    [37m white [47m white
    [38m, [39m, [48m, [49m are reserved
    156 6E n * DSR Device Status Report
    [0n Terminal is ready, no malfunctions
    [1n Terminal is busy, retry later
    [2n Terminal is busy, sends DSR when ready
    [3n Malfunction, try again
    [4n Malfunction, sends DSR when ready
    [5n report status
    [6n report cursor position (CPR)
    [?10n OK,
    [?11n = not OK,
    [?13n = no printer.
    [?15n report printer status, returns:
    [?25n "Are User Defined Keys Locked?" (VT220)
    157 6F o DAQ - Define Area Qualification starting at current position
    [0o Accept all input, transmit on request
    [1o Protected and guarded, accept no input, do not transmit
    [2o Accept any printing character in this field
    [3o Numeric only field
    [4o Alphabetic (A-Z and a-z) only
    [5o Right justify in area
    [3;6o Zero fill in area
    [7o Set horizontal tab stop, this is the start of the field
    [8o Protected and unguarded, accept no input, do transmit
    [9o Space fill in area
    Private Control Sequences (allowed by ANSI X3.41-1974).
    160 70 p DECSTR - Soft Terminal Reset [!p
    161 71 q DECLL - Load LEDs
    [0 q Turn off all, [1;4q turns on L1 and L4,
    (£inux 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

    see vim.wikia.com/wiki/Configuring_the_cursor .- don't omit space
    [0 q blinking block
    [1 q blinking block
    [2 q solid block
    [3 q blinking underscore
    [4 q solid underscore
    [5 q blinking vertile
    [6 q solid verticle

    
    
    162 72 r DECSTBM top and bottom margins (scroll region on VT100) [4;20r top margin at line 4 and bottom at line 20 163 73 s DECSTRM left and right margins on LA100,LA120 [5;130s left margin at column 5 and right at column 130
    164 74 t DECSLPP physical lines per page [66t Paper has 66 lines (11 inches at 6 per inch)

    GUI window position & size

    $'\e[1t' Restore ; $'\e[2t' Minimize ; $'\e[9;1t' Maximize ;
    $'\e[3;0;0t' window to Home (top, left(i.e. 0;0)) ;
    $'\e[5t' bring to Foreground ;
    $'\e[8;hh;wwt' set window size mac book pro: font:Andale mono 14: max width is width of screen i.e. 158.
    mac os keystrokes:
    Increase font size: ⌘+ . When the window reaches the screen size, reduces columns
    Reduce  font size ⌘- , which permits more rows and columns.
    Restore ⌘0 but does NOT restore columns!
    165 75 u DECSHTS many horizontal tab stops at once on LA100 [9;17;25;33;41;49;57;65;73;81u standard tab stops
    166 76 v DECSVTS many vertical tab stops at once on LA100 [1;16;31;45v vert tabs every 15 lines
    167 77 w DECSHORP 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 [11~=F1… [17~=F6…[34~=F20 ([23~=ESC,[24~=BS,[25~=LF,[28~=HELP,[29~=DO)
    177 7F DELETE is always ignored


    Control Sequences with intermediate characters (from ANSI X3.64-1979).
    Note that there is a SPACE character before the terminating alphabetic.
    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 F   No justification
            [1 F   Fill, bringing words up from next line if necessary
            [2 F   Interword spacing, adjust spaces between words
            [3 F   Letter spacing, adjust width of each letter
            [4 F   Use hyphenation
            [5 F   Flush left margin
            [6 F   Center following text between margins (until [0 E)
            [7 F   Flush right margin
            [8 F   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:

    1. To act as a passive display, implement the 4 cursor commands, the 2 erase commands, direct cursor addressing, and at least inverse characters.
      The software should be capable of handling strings with 16 numeric parameters with values in the range of 0 to 255.
        [A      move cursor up one row, stop if a top of screen
        [B      move cursor down one row, stop if at bottom of screen
        [C      move cursor forward one column, stop if at right edge of screen
        [D      move cursor backward one column, stop if at left edge of screen
        [H      Home to row 1 column 1 (also [1;1H)
        [J      Clear from current position to bottom of screen
        [K      Clear from current position to end of line
        [24;80H Position to line 24 column 80 (any line 1 to 24, any column 1 to 132)
        [0m     Clear attributes to normal characters
        [7m     Add the inverse video attribute to succeeding characters
        [0;7m   Set character attributes to inverse video only
      
    2. To enter data in VT100 mode, implement the 4 cursor keys and the 4 PF keys.
      It must be possible to enter ESC, TAB, BS, DEL, and LF from the keyboard.
        [A       Sent by the up-cursor key (alternately ESC O A)
        [B       Sent by the down-cursor key (alternately ESC O B)
        [C       Sent by the right-cursor key (alternately ESC O C)
        [D       Sent by the left-cursor key (alternately ESC O D)
        OP       PF1 key sends ESC O P
        OQ       PF2 key sends ESC O Q
        OR       PF3 key sends ESC O R
        OS       PF3 key sends ESC O S
        [c       Request for the terminal to identify itself
        [?1;0c   VT100 with memory for 24 by 80, inverse video character attribute
        [?1;2c   VT100 capable of 132 column mode, with bold+blink+underline+inverse
      
      
    3. When doing full-screen editing on a VT100, implement directed erase, the numeric keypad in applications mode, and
      the limited scrolling region.
      The latter is needed to do insert/delete line functions without rewriting the screen.
        [0J     erase from current position to bottom of screen inclusive
        [1J     erase from top of screen to current position inclusive
        [2J     erase entire screen (without moving the cursor)
        [0K     erase from current position to end of line inclusive
        [1K     erase from beginning of line to current position inclusive
        [2K     erase entire line (without moving cursor)
      
       £  [12;24r   Set scrolling region to lines 12 thru 24.  
      If a linefeed or an INDex is received while on line 24, the former line 12 is deleted and rows 13-24 move up.
      If a RI (reverse Index) is received while on line 12, a blank line is inserted there as rows 12-13 move down.
      All VT100 compatible terminals (except GIGI) have this feature. ESC Set numeric keypad to applications mode ESC > Set numeric keypad to numbers mode OA Up-cursor key sends ESC O A after ESC ESC [ ? 1 h OB Down-cursor key sends ESC O B " " " OC Right-cursor key sends ESC O B " " " OB Left-cursor key sends ESC O B " " " OM ENTER key sends ESC O M after ESC = Ol COMMA on keypad sends ESC O l " " (that's lowercase L) Om MINUS on keypad sends ESC O m " " Op ZERO on keypad sends ESC O p " " Oq ONE on keypad sends ESC O q " " Or TWO on keypad sends ESC O r " " Os THREE on keypad sends ESC O s " " Ot FOUR on keypad sends ESC O t " " Ou FIVE on keypad sends ESC O u " " Ov SIX on keypad sends ESC O v " " Ow SEVEN on keypad sends ESC O w " " Ox EIGHT on keypad sends ESC O x " " Oy NINE on keypad sends ESC O y " "
    4. If the hardware is capable of double width/double height:
        #3     Top half of a double-width double-height line
        #4     Bottom half of a double-width double-height line
        #5     Make line single-width (lines are set this way when cleared by ESC [ J)
        #6     Make line double-width normal height (40 or 66 characters)
      
    5. If the terminal emulator is capable of insert/delete characters, insert/delete lines, insert/replace mode, and
      can do a full-screen dump to the printer (in text mode), then it should identify itself as a VT102
        [c     Request for the terminal to identify itself
        [?6c   VT102 (printer port, 132 column mode, and ins/del standard)
        [1@    Insert a blank character position (shift line to the right)
        [1P    Delete a character position (shift line to the left)
        [1L    Insert blank line at current row (shift screen down)
        [1M    Delete the current line (shift screen up)
        [4h    Set insert mode, new characters shove existing ones to the right
        [4l    Reset insert mode, new characters replace existing ones
        [0i    Print screen (all 24 lines) to the printer
        [4i    All received data goes to the printer (nothing to the screen)
        [5i    All received data goes to the screen (nothing to the printer)
      

    see XTerm Control Sequences

    The VT100 USER GUIDE and ANSI standard X3.64-1979 both list the ANSI ESCape sequences in alphabetic order by mnemonic, but do not have a have a cross reference in order by ASCII code. This document lists the combination of all definitions from the three ANSI standards in numeric order. For a description of the advantages of using these standards, see the article "Toward Standardized Video Terminals" in the April-1984 issue of BYTE magazine.

    ANSI X3.41-1974 introduces 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. Defines the format of all ESCape sequences, but only the 3-character ones with a parameter character in the middle. HThese instruct the terminal how to interpret the C0, G0, C1, and G1 characters (such as by selecting different character-set ROMs).

    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.4-1977 defined the 7-bit ASCII character set (C0 and G0) in 1968, revised in 1977, and explains the decisions made in laying out the ASCII code. It explains why ANSI chose to make ASCII incompatible with EBCDIC in order to make it self-consistant.

    ANSI X3.64-1979 defines the remaining ESCape sequences. 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 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.

    ECMA-48 (aka "ISO 6429") XTERM

    See also

    Console Codes linux Man page