ansi codes

From: Jurko Gospodnetic (
Date: 04/08/96

if anyone is interested here's a whole listing of ansi codes I found....

after my long long search the best list was right under my nose in
man screen :-)))) and this is it.... just view it with more, less, cut
or whatever.... 

Have phun,

--- [ snip it off here ] ------------------------------------------------------

     The following is a list of control sequences  recognized  by
     _s_c_r_e_e_n.   "(V)"  and "(A)" indicate VT100-specific and ANSI-
     or ISO-specific functions, respectively.

     EEEESSSSCCCC EEEE                      Next Line

     EEEESSSSCCCC DDDD                      Index

     EEEESSSSCCCC MMMM                      Reverse Index

     EEEESSSSCCCC HHHH                      Horizontal Tab Set

     EEEESSSSCCCC ZZZZ                      Send VT100 Identification String

     EEEESSSSCCCC 7777                 (V)  Save Cursor and Attributes

     EEEESSSSCCCC 8888                 (V)  Restore Cursor and Attributes

     EEEESSSSCCCC [[[[ssss                (A)  Save Cursor and Attributes

     EEEESSSSCCCC [[[[uuuu                (A)  Restore Cursor and Attributes

     EEEESSSSCCCC cccc                      Reset to Initial State

     EEEESSSSCCCC gggg                      Visual Bell

     EEEESSSSCCCC Pn pppp                   Cursor Visibility (97801)

         Pn = 6666                 Invisible

              7777                 Visible

     EEEESSSSCCCC ====                 (V)  Application Keypad Mode

     EEEESSSSCCCC >>>>                 (V)  Numeric Keypad Mode

     EEEESSSSCCCC #### 8888               (V)  Fill Screen with E's

     EEEESSSSCCCC \\\\                 (A)  String Terminator

     EEEESSSSCCCC ^^^^                 (A)  Privacy Message  String  (Message

     EEEESSSSCCCC !!!!                      Global  Message  String  (Message

     EEEESSSSCCCC kkkk                      A.k.a. Definition String

     EEEESSSSCCCC PPPP                 (A)  Device Control String.  Outputs a
                                string  directly to the host ter-
                                minal without interpretation.

     EEEESSSSCCCC ____                 (A)  Application    Program    Command

     EEEESSSSCCCC ]]]]                 (A)  Operating     System      Command
                                (Hardstatus, xterm title hack)

     CCCCoooonnnnttttrrrroooollll----NNNN             (A)  Lock Shift G1 (SO)

     CCCCoooonnnnttttrrrroooollll----OOOO             (A)  Lock Shift G0 (SI)

     EEEESSSSCCCC nnnn                 (A)  Lock Shift G2

     EEEESSSSCCCC oooo                 (A)  Lock Shift G3

     EEEESSSSCCCC NNNN                 (A)  Single Shift G2

     EEEESSSSCCCC OOOO                 (A)  Single Shift G3

     EEEESSSSCCCC (((( Pcs             (A)  Designate character set as G0

     EEEESSSSCCCC )))) Pcs             (A)  Designate character set as G1

     EEEESSSSCCCC **** Pcs             (A)  Designate character set as G2

     EEEESSSSCCCC ++++ Pcs             (A)  Designate character set as G3

     EEEESSSSCCCC [[[[ Pn ;;;; Pn HHHH            Direct Cursor Addressing

     EEEESSSSCCCC [[[[ Pn ;;;; Pn ffff            Direct Cursor Addressing

     EEEESSSSCCCC [[[[ Pn JJJJ                 Erase in Display

           Pn = None or 0000       From Cursor to End of Screen

                1111               From Beginning of Screen to  Cur-

                2222               Entire Screen

     EEEESSSSCCCC [[[[ Pn KKKK                 Erase in Line

           Pn = None or 0000       From Cursor to End of Line

                1111               From Beginning of Line to Cursor

                2222               Entire Line

     EEEESSSSCCCC [[[[ Pn AAAA                 Cursor Up

     EEEESSSSCCCC [[[[ Pn BBBB                 Cursor Down

     EEEESSSSCCCC [[[[ Pn CCCC                 Cursor Right

     EEEESSSSCCCC [[[[ Pn DDDD                 Cursor Left

     EEEESSSSCCCC [[[[ Ps ;;;;...;;;; Ps mmmm        Select Graphic Rendition

           Ps = None or 0000       Default Rendition

                1111               Bold

                2222          (A)  Faint

                3333          (A)  _S_t_a_n_d_o_u_t Mode (ANSI: Italicized)

                4444               Underlined

                5555               Blinking

                7777               Negative Image

                22222222         (A)  Normal Intensity

                22223333         (A)  _S_t_a_n_d_o_u_t Mode off  (ANSI:  Itali-
                                cized off)

                22224444         (A)  Not Underlined

                22225555         (A)  Not Blinking

                22227777         (A)  Positive Image

                33330000         (A)  Foreground Black

                33331111         (A)  Foreground Red

                33332222         (A)  Foreground Green

                33333333         (A)  Foreground Yellow

                33334444         (A)  Foreground Blue

                33335555         (A)  Foreground Magenta

                33336666         (A)  Foreground Cyan

                33337777         (A)  Foreground White

                33339999         (A)  Foreground Default

                44440000         (A)  Background Black


                44449999         (A)  Background Default

     EEEESSSSCCCC [[[[ Pn gggg                 Tab Clear

           Pn = None or 0000       Clear Tab at Current Position

                3333               Clear All Tabs

     EEEESSSSCCCC [[[[ Pn ;;;; Pn rrrr       (V)  Set Scrolling Region

     EEEESSSSCCCC [[[[ Pn IIII            (A)  Horizontal Tab

     EEEESSSSCCCC [[[[ Pn ZZZZ            (A)  Backward Tab

     EEEESSSSCCCC [[[[ Pn LLLL            (A)  Insert Line

     EEEESSSSCCCC [[[[ Pn MMMM            (A)  Delete Line

     EEEESSSSCCCC [[[[ Pn @@@@            (A)  Insert Character

     EEEESSSSCCCC [[[[ Pn PPPP            (A)  Delete Character

     EEEESSSSCCCC [[[[ Pn SSSS                 Scroll Scrolling Region Up

     EEEESSSSCCCC [[[[ Pn TTTT                 Scroll Scrolling Region Down

     EEEESSSSCCCC [[[[ Ps ;;;;...;;;; Ps hhhh        Set Mode

     EEEESSSSCCCC [[[[ Ps ;;;;...;;;; Ps llll        Reset Mode

           Ps = 4444          (A)  Insert Mode

                22220000         (A)  _A_u_t_o_m_a_t_i_c _L_i_n_e_f_e_e_d Mode

                33334444              Normal Cursor Visibility

                ????1111         (V)  Application Cursor Keys

                ????3333         (V)  Change  Terminal  Width  to   132

                ????5555         (V)  Reverse Video

                ????6666         (V)  _O_r_i_g_i_n Mode

                ????7777         (V)  _W_r_a_p Mode

                ????22225555        (V)  Visible Cursor

     EEEESSSSCCCC [[[[ 5555 iiii             (A)  Start  relay  to  printer   (ANSI
                                Media Copy)

     EEEESSSSCCCC [[[[ 4444 iiii             (A)  Stop relay to printer (ANSI Media

     EEEESSSSCCCC [[[[ 8888 ;;;; Ph ;;;; Pw tttt        Resize the window to  `Ph'  lines
                                and  `Pw'  columns  (SunView spe-

     EEEESSSSCCCC [[[[ cccc                    Send VT100 Identification String

     EEEESSSSCCCC [[[[ xxxx                    Send Terminal Parameter Report

     EEEESSSSCCCC [[[[ >>>> cccc                  Send   VT220   Secondary   Device
                                Attributes String

     EEEESSSSCCCC [[[[ 6666 nnnn                  Send Cursor Position Report

     In order to do a full VT100 emulation _s_c_r_e_e_n has  to  detect
     that  a  sequence of characters in the input stream was gen-
     erated by a keypress on the user's keyboard and  insert  the
     VT100  style escape sequence. _S_c_r_e_e_n has a very flexible way
     of doing this by making it posible to map arbitrary commands
     on  arbitrary  sequences  of  characters. For standard VT100
     emulation the command will always insert  a  string  in  the
     input  buffer  of  the window (see also command ssssttttuuuuffffffff in the
     command  table).   Because  the  sequences  generated  by  a
     keypress can change after a reattach from a different termi-
     nal type, it is possible to bind  commands  to  the  termcap
     name  of  the  keys.  _S_c_r_e_e_n will insert the correct binding
     after each reattach. See the  bbbbiiiinnnnddddkkkkeeeeyyyy  command  for  further
     details on the syntax and examples.

     Here is the table of the default  key  bindings.  (A)  means
     that  the  command  is  executed if the keyboard is switched
     into application mode.

     Key name          Termcap name    Command
     Cursor up             ku          stuff \033[A
                                       stuff \033OA    (A)
     Cursor down           kd          stuff \033[B
                                       stuff \033OB    (A)
     Cursor right          kr          stuff \033[C
                                       stuff \033OC    (A)
     Cursor left           kl          stuff \033[D
                                       stuff \033OD    (A)
     Function key 0        k0          stuff \033[10~
     Function key 1        k1          stuff \033OP
     Function key 2        k2          stuff \033OQ
     Function key 3        k3          stuff \033OR
     Function key 4        k4          stuff \033OS
     Function key 5        k5          stuff \033[15~
     Function key 6        k6          stuff \033[17~
     Function key 7        k7          stuff \033[18~
     Function key 8        k8          stuff \033[19~
     Function key 9        k9          stuff \033[20~
     Function key 10       k;          stuff \033[21~
     Function key 11       F1          stuff \033[22~
     Function key 12       F2          stuff \033[23~
     Backspace             kb          stuff \010
     Home                  kh          stuff \033[1~
     End                   kH          stuff \033[4~
     Insert                kI          stuff \033[2~
     Delete                kD          stuff \033[3~
     Page up               kP          stuff \033[5~
     Page down             kN          stuff \033[6~
     Keypad 0              f0          stuff 0
                                       stuff \033Op    (A)
     Keypad 1              f1          stuff 1
                                       stuff \033Oq    (A)
     Keypad 2              f2          stuff 2
                                       stuff \033Or    (A)
     Keypad 3              f3          stuff 3
                                       stuff \033Os    (A)
     Keypad 4              f4          stuff 4
                                       stuff \033Ot    (A)
     Keypad 5              f5          stuff 5
                                       stuff \033Ou    (A)
     Keypad 6              f6          stuff 6
                                       stuff \033Ov    (A)
     Keypad 7              f7          stuff 7
                                       stuff \033Ow    (A)
     Keypad 8              f8          stuff 8
                                       stuff \033Ox    (A)
     Keypad 9              f9          stuff 9
                                       stuff \033Oy    (A)
     Keypad +              f+          stuff +
                                       stuff \033Ok    (A)
     Keypad -              f-          stuff -
                                       stuff \033Om    (A)
     Keypad *              f*          stuff *
                                       stuff \033Oj    (A)
     Keypad /              f/          stuff /
                                       stuff \033Oo    (A)
     Keypad =              fq          stuff =
                                       stuff \033OX    (A)
     Keypad .              f.          stuff .
                                       stuff \033On    (A)
     Keypad ,              f,          stuff ,
                                       stuff \033Ol    (A)
     Keypad enter          fe          stuff \015
                                       stuff \033OM    (A)

     The following table describes all terminal capabilities that
     are  recognized  by  _s_c_r_e_e_n  and  are  not in the termcap(5)
     manual.  You can place these capabilities  in  your  termcap
     entries  (in  `/etc/termcap')  or use them with the commands
     `termcap', `terminfo' and  `termcapinfo'  in  your  screenrc
     files.  It is often not possible to place these capabilities
     in the terminfo database.

     LLLLPPPP   (_b_o_o_l)  Terminal has VT100 style margins  (`magic  mar-
                  gins').  Note  that this capability is obsolete
                  because _s_c_r_e_e_n uses the standard 'xn' instead.

     ZZZZ0000   (_s_t_r)   Change width to 132 columns.

     ZZZZ1111   (_s_t_r)   Change width to 80 columns.

     WWWWSSSS   (_s_t_r)   Resize display. This capability has the desired
                  width  and  height  as  arguments.  _S_u_n_V_i_e_w(_t_m)
                  example: '\E[8;%d;%dt'.

     NNNNFFFF   (_b_o_o_l)  Terminal doesn't need flow control. Send ^S and
                  ^Q  direct  to  the  application. Same as 'flow
                  off'. The opposite of this capability is 'nx'.

     GGGG0000   (_b_o_o_l)  Terminal can deal with ISO 2022 font  selection

     SSSS0000   (_s_t_r)   Switch charset 'G0' to the  specified  charset.
                  Default is '\E(%.'.

     EEEE0000   (_s_t_r)   Switch charset 'G0' back to  standard  charset.
                  Default is '\E(B'.

     CCCC0000   (_s_t_r)   Use the string as a conversion table  for  font
                  '0'. See the 'ac' capability for more details.

     CCCCSSSS   (_s_t_r)   Switch cursorkeys to application mode.

     CCCCEEEE   (_s_t_r)   Switch cursorkeys back to normal mode.

     AAAANNNN   (_b_o_o_l)  Turn on autonuke. See  the  'autonuke'  command
                  for more details.

     OOOOLLLL   (_n_u_m)   Set  the   output   buffer   limit.   See   the
                  'obuflimit' command for more details.

     KKKKJJJJ   (_s_t_r)   Set the  kanji  type  of  the  terminal.  Valid
                  strings are "jis", "euc" and "sjis".

     AAAAFFFF   (_s_t_r)   Change character forground  color  in  an  ANSI
                  conform way. This capability will almost always
                  be set to '\E[3%dm' ('\E[3%p1%dm'  on  terminfo

     AAAABBBB   (_s_t_r)   Same as 'AF', but change background color.

     AAAAXXXX   (_b_o_o_l)  Does understand ANSI set  default  fg/bg  color
                  (\E[39m / \E[49m).

     XXXXCCCC   (_s_t_r)   Describe a translation of characters to strings
                  depending  on  the  current  font. More details
                  follow in the next section.

     _S_c_r_e_e_n has a powerful mechanism to translate  characters  to
     arbitrary strings depending on the current font and terminal
     type.  Use this feature if you want to work  with  a  common
     standard  character  set (say ISO8851-latin1) even on termi-
     nals that scatter the more unusual characters  over  several
     national language font pages.

         <_c_h_a_r_s_e_t-_m_a_p_p_i_n_g> := <_d_e_s_i_g_n_a_t_o_r><_t_e_m_p_l_a_t_e>{,,,,<_m_a_p_p_i_n_g>}
         <_m_a_p_p_i_n_g> := <_c_h_a_r-_t_o-_b_e-_m_a_p_p_e_d><_t_e_m_p_l_a_t_e-_a_r_g>

     The things in braces may be repeated any number of times.

     A <_c_h_a_r_s_e_t-_m_a_p_p_i_n_g> tells _s_c_r_e_e_n how to  map  characters  in
     font  <_d_e_s_i_g_n_a_t_o_r>  ('B': Ascii, 'A': UK, 'K': german, etc.)
     to strings. Every <_m_a_p_p_i_n_g> describes to what string a  sin-
     gle  character  will  be translated. A template mechanism is
     used, as most of the time the codes have  a  lot  in  common
     (for example strings to switch to and from another charset).
     Each occurence of '%' in <_t_e_m_p_l_a_t_e>  gets  substituted  with
     the <_t_e_m_p_l_a_t_e-_a_r_g> specified together with the character. If
     your strings are not similar at all, then use '%' as a  tem-
     plate and place the full string in <_t_e_m_p_l_a_t_e-_a_r_g>. A quoting
     mechanism was added to make it possible to use a  real  '%'.
     The  '\'  character  quotes the special characters '\', '%',
     and ','.

     Here is an example:

         termcap hp700 'XC=B\E(K%\E(B,\304[,\326\\\\,\334]'

     This tells _s_c_r_e_e_n, how to translate ISOlatin1 (charset  'B')
     upper  case umlaut characters on a hp700 terminal that has a
     german charset. '\304' gets translated to '\E(K[\E(B' and so
     on.   Note  that  this line gets parsed *three* times before
     the internal lookup table is built, therefore a lot of quot-
     ing is needed to create a single '\'.

     Another extension was added to allow more  emulation:  If  a
     mapping translates the unquoted '%' char, it will be sent to
     the terminal whenever _s_c_r_e_e_n switches to  the  corresponding
     <_d_e_s_i_g_n_a_t_o_r>.  In  this special case the template is assumed
     to be just '%' because the charset switch sequence  and  the
     character mappings normaly haven't much in common.

     This example shows one use of the extension:

         termcap xterm 'XC=K%,%\E(B,[\304,\\\\\326,]\334'

     Here, a part of the german ('K') charset is emulated  on  an
     xterm.   If  _s_c_r_e_e_n has to change to the 'K' charset, '\E(B'
     will be sent to the terminal, i.e. the ASCII charset is used
     instead.  The  template  is  just  '%',  so  the  mapping is
     straightforward: '[' to '\304', '\' to '\326',  and  ']'  to

     TERM           Terminal name.
     TERMCAP        Terminal description.

     <socket directory>/.termcap Written by the "termcap"  output
     /usr/lib/terminfo/?/*       or
     /etc/termcap                Terminal capability databases

This archive was generated by hypermail 2b30 : 12/18/00 PST