CONTRIBUTING.d/patches: Please provide a git-range-diff(1)
[man-pages.git] / man4 / console_codes.4
blob5d4af9cf92259d4b7a2f29739d09ae24b29a3223
1 '\" t
2 .\" Copyright (c) 1996 Andries Brouwer <aeb@cwi.nl>, Mon Oct 31 22:13:04 1996
3 .\"
4 .\" SPDX-License-Identifier: GPL-2.0-or-later
5 .\"
6 .\" This is combined from many sources.
7 .\" For Linux, the definitive source is of course console.c.
8 .\" About vt100-like escape sequences in general there are
9 .\" the ISO/IEC 6429 and ISO/IEC 2022 norms, the descriptions of
10 .\" an actual vt100, and the xterm docs (ctlseqs.ms).
11 .\" Substantial portions of this text are derived from a write-up
12 .\" by Eric S. Raymond <esr@thyrsus.com>.
13 .\"
14 .\" Tiny correction, aeb, 961107.
15 .\"
16 .\" 2006-05-27, Several corrections - Thomas E. Dickey
17 .\"
18 .TH console_codes 4 (date) "Linux man-pages (unreleased)"
19 .SH NAME
20 console_codes \- Linux console escape and control sequences
21 .SH DESCRIPTION
22 The Linux console implements a large subset of
23 the VT102 and ECMA-48 / ISO/IEC\~6429 / ANSI X3.64 terminal controls,
24 plus certain private-mode sequences
25 for changing the color palette, character-set mapping, and so on.
26 In the tabular descriptions below, the second column gives ECMA-48 or DEC
27 mnemonics (the latter if prefixed with DEC) for the given function.
28 Sequences without a mnemonic are neither ECMA-48 nor VT102.
30 After all the normal output processing has been done, and a
31 stream of characters arrives at the console driver for actual
32 printing, the first thing that happens is a translation from
33 the code used for processing to the code used for printing.
35 If the console is in UTF-8 mode, then the incoming bytes are
36 first assembled into 16-bit Unicode codes.
37 Otherwise, each byte is transformed according to the current mapping table
38 (which translates it to a Unicode value).
39 See the \fBCharacter Sets\fP section below for discussion.
41 In the normal case, the Unicode value is converted to a font index,
42 and this is stored in video memory, so that the corresponding glyph
43 (as found in video ROM) appears on the screen.
44 Note that the use of Unicode (and the design of the PC hardware)
45 allows us to use 512 different glyphs simultaneously.
47 If the current Unicode value is a control character, or we are
48 currently processing an escape sequence, the value will treated
49 specially.
50 Instead of being turned into a font index and rendered as
51 a glyph, it may trigger cursor movement or other control functions.
52 See the \fBLinux Console Controls\fP section below for discussion.
54 It is generally not good practice to hard-wire terminal controls into
55 programs.
56 Linux supports a
57 .BR terminfo (5)
58 database of terminal capabilities.
59 Rather than emitting console escape sequences by hand, you will almost
60 always want to use a terminfo-aware screen library or utility such as
61 .BR ncurses (3),
62 .BR tput (1),
64 .BR reset (1).
65 .SS Linux console controls
66 This section describes all the control characters and escape sequences
67 that invoke special functions (i.e., anything other than writing a
68 glyph at the current cursor location) on the Linux console.
70 .B "Control characters"
72 A character is a control character if (before transformation
73 according to the mapping table) it has one of the 14 codes
74 00 (NUL), 07 (BEL), 08 (BS), 09 (HT), 0a (LF), 0b (VT),
75 0c (FF), 0d (CR), 0e (SO), 0f (SI), 18 (CAN), 1a (SUB),
76 1b (ESC), 7f (DEL).
77 One can set a "display control characters" mode (see below),
78 and allow 07, 09, 0b, 18, 1a, 7f to be displayed as glyphs.
79 On the other hand, in UTF-8 mode all codes 00\[en]1f are regarded
80 as control characters, regardless of any "display control characters"
81 mode.
83 If we have a control character, it is acted upon immediately
84 and then discarded (even in the middle of an escape sequence)
85 and the escape sequence continues with the next character.
86 (However, ESC starts a new escape sequence, possibly aborting a previous
87 unfinished one, and CAN and SUB abort any escape sequence.)
88 The recognized control characters are BEL, BS, HT, LF, VT, FF,
89 CR, SO, SI, CAN, SUB, ESC, DEL, CSI.
90 They do what one would expect:
91 .TP
92 BEL (0x07, \fB\[ha]G\fP)
93 beeps;
94 .TP
95 BS (0x08, \fB\[ha]H\fP)
96 backspaces one column
97 (but not past the beginning of the line);
98 .TP
99 HT (0x09, \fB\[ha]I\fP)
100 goes to the next tab stop or to the end of the line
101 if there is no earlier tab stop;
103 LF (0x0A, \fB\[ha]J\fP)
105 VT (0x0B, \fB\[ha]K\fP)
107 FF (0x0C, \fB\[ha]L\fP)
108 all give a linefeed,
109 and if LF/NL (new-line mode) is set also a carriage return;
111 CR (0x0D, \fB\[ha]M\fP)
112 gives a carriage return;
114 SO (0x0E, \fB\[ha]N\fP)
115 activates the G1 character set;
117 SI (0x0F, \fB\[ha]O\fP)
118 activates the G0 character set;
120 CAN (0x18, \fB\[ha]X\fP)
122 SUB (0x1A, \fB\[ha]Z\fP)
123 abort escape sequences;
125 ESC (0x1B, \fB\[ha][\fP)
126 starts an escape sequence;
128 DEL (0x7F)
129 is ignored;
131 CSI (0x9B)
132 is equivalent to ESC [.
134 .B "ESC- but not CSI-sequences"
135 .ad l
137 l l lx.
138 ESC c   RIS     Reset.
139 ESC D   IND     Linefeed.
140 ESC E   NEL     Newline.
141 ESC H   HTS     Set tab stop at current column.
142 ESC M   RI      Reverse linefeed.
143 ESC Z   DECID   T{
144 DEC private identification. The kernel
145 returns the string  ESC [ ? 6 c, claiming
146 that it is a VT102.
148 ESC 7   DECSC   T{
149 Save current state (cursor coordinates,
150 attributes, character sets pointed at by G0, G1).
152 ESC 8   DECRC   T{
153 Restore state most recently saved by ESC 7.
155 ESC %           Start sequence selecting character set
156 ESC % @         \0\0\0Select default (ISO/IEC\~646 / ISO/IEC\~8859-1)
157 ESC % G         \0\0\0Select UTF-8
158 ESC % 8         \0\0\0Select UTF-8 (obsolete)
159 ESC # 8 DECALN  T{
160 DEC screen alignment test \- fill screen with E's.
162 ESC (           T{
163 Start sequence defining G0 character set
164 (followed by one of B, 0, U, K, as below)
166 ESC ( B         T{
167 Select default (ISO/IEC\~8859-1 mapping).
169 ESC ( 0         T{
170 Select VT100 graphics mapping.
172 ESC ( U         T{
173 Select null mapping \- straight to character ROM.
175 ESC ( K         T{
176 Select user mapping \- the map that is loaded by the utility \fBmapscrn\fP(8).
178 ESC )           T{
179 Start sequence defining G1 (followed by one of B, 0, U, K, as above).
181 ESC >   DECPNM  Set numeric keypad mode
182 ESC =   DECPAM  Set application keypad mode
183 ESC ]   OSC     T{
184 Operating System Command prefix.
186 ESC ] R         Reset palette.
187 ESC ] P         T{
188 Set palette, with parameter given in 7 hexadecimal digits \fInrrggbb\fP after
189 the final P. Here \fIn\fP is the color (0\[en]15), and \fIrrggbb\fP indicates
190 the red/green/blue values (0\[en]255).
195 .B "ECMA-48 CSI sequences"
197 CSI (or ESC [) is followed by a sequence of parameters,
198 at most NPAR (16), that are decimal numbers separated by
199 semicolons.
200 An empty or absent parameter is taken to be 0.
201 The sequence of parameters may be preceded by a single question mark.
203 However, after CSI [ (or ESC [ [) a single character is read
204 and this entire sequence is ignored.
205 (The idea is to ignore an echoed function key.)
207 The action of a CSI sequence is determined by its final character.
208 .ad l
210 l l lx.
211 @       ICH     T{
212 Insert the indicated # of blank characters.
214 A       CUU     T{
215 Move cursor up the indicated # of rows.
217 B       CUD     T{
218 Move cursor down the indicated # of rows.
220 C       CUF     T{
221 Move cursor right the indicated # of columns.
223 D       CUB     T{
224 Move cursor left the indicated # of columns.
226 E       CNL     T{
227 Move cursor down the indicated # of rows, to column 1.
229 F       CPL     T{
230 Move cursor up the indicated # of rows, to column 1.
232 G       CHA     T{
233 Move cursor to indicated column in current row.
235 H       CUP     T{
236 Move cursor to the indicated row, column (origin at 1,1).
238 J       ED      T{
239 Erase display (default: from cursor to end of display).
241                 T{
242 ESC [ 1 J: erase from start to cursor.
244                 T{
245 ESC [ 2 J: erase whole display.
247                 T{
248 ESC [ 3 J: erase whole display including scroll-back
249 buffer (since Linux 3.0).
251 .\" ESC [ 3 J: commit f8df13e0a901fe55631fed66562369b4dba40f8b
252 K       EL      T{
253 Erase line (default: from cursor to end of line).
255                 T{
256 ESC [ 1 K: erase from start of line to cursor.
258                 T{
259 ESC [ 2 K: erase whole line.
261 L       IL      T{
262 Insert the indicated # of blank lines.
264 M       DL      T{
265 Delete the indicated # of lines.
267 P       DCH     T{
268 Delete the indicated # of characters on current line.
270 X       ECH     T{
271 Erase the indicated # of characters on current line.
273 a       HPR     T{
274 Move cursor right the indicated # of columns.
276 c       DA      T{
277 Answer ESC [ ? 6 c: "I am a VT102".
279 d       VPA     T{
280 Move cursor to the indicated row, current column.
282 e       VPR     T{
283 Move cursor down the indicated # of rows.
285 f       HVP     T{
286 Move cursor to the indicated row, column.
288 g       TBC     T{
289 Without parameter: clear tab stop at current position.
291                 T{
292 ESC [ 3 g: delete all tab stops.
294 h       SM      Set Mode (see below).
295 l       RM      Reset Mode (see below).
296 m       SGR     Set attributes (see below).
297 n       DSR     Status report (see below).
298 q       DECLL   Set keyboard LEDs.
299                 ESC [ 0 q: clear all LEDs
300                 ESC [ 1 q: set Scroll Lock LED
301                 ESC [ 2 q: set Num Lock LED
302                 ESC [ 3 q: set Caps Lock LED
303 r       DECSTBM T{
304 Set scrolling region; parameters are top and bottom row.
306 s       ?       Save cursor location.
307 u       ?       Restore cursor location.
308 \`      HPA     T{
309 Move cursor to indicated column in current row.
314 .B ECMA-48 Select Graphic Rendition
316 The ECMA-48 SGR sequence ESC [ \fIparameters\fP m sets display
317 attributes.
318 Several attributes can be set in the same sequence, separated by
319 semicolons.
320 An empty parameter (between semicolons or string initiator or
321 terminator) is interpreted as a zero.
322 .ad l
324 l lx.
325 param   result
326 0       T{
327 reset all attributes to their defaults
329 1       set bold
330 2       T{
331 set half-bright (simulated with color on a color display)
333 3       set italic (since Linux 2.6.22; simulated with color on a color display)
334 4       T{
335 set underscore (simulated with color on a color display)
336 (the colors used to simulate dim or underline are set
337 using ESC ] ...)
339 5       set blink
340 7       set reverse video
341 10      T{
342 reset selected mapping, display control flag,
343 and toggle meta flag (ECMA-48 says "primary font").
345 11      T{
346 select null mapping, set display control flag,
347 reset toggle meta flag (ECMA-48 says "first alternate font").
349 12      T{
350 select null mapping, set display control flag,
351 set toggle meta flag (ECMA-48 says "second alternate font").
352 The toggle meta flag
353 causes the high bit of a byte to be toggled
354 before the mapping table translation is done.
356 21      T{
357 set underline; before Linux 4.17, this value
358 set normal intensity (as is done in many other terminals)
360 22      set normal intensity
361 23      italic off (since Linux 2.6.22)
362 24      underline off
363 25      blink off
364 27      reverse video off
365 30      set black foreground
366 31      set red foreground
367 32      set green foreground
368 33      set brown foreground
369 34      set blue foreground
370 35      set magenta foreground
371 36      set cyan foreground
372 37      set white foreground
373 38      T{
374 256/24-bit foreground color follows, shoehorned into 16 basic colors
375 (before Linux 3.16: set underscore on, set default foreground color)
377 39      T{
378 set default foreground color
379 (before Linux 3.16: set underscore off, set default foreground color)
381 40      set black background
382 41      set red background
383 42      set green background
384 43      set brown background
385 44      set blue background
386 45      set magenta background
387 46      set cyan background
388 47      set white background
389 48      T{
390 256/24-bit background color follows, shoehorned into 8 basic colors
392 49      set default background color
393 90..97  T{
394 set foreground to bright versions of 30..37
396 100..107        T{
397 set background, same as 40..47 (bright not supported)
402 Commands 38 and 48 require further arguments:
404 l lx.
405 ;5;x    T{
406 256 color: values 0..15 are IBGR (black, red, green, ... white),
407 16..231 a 6x6x6 color cube, 232..255 a grayscale ramp
409 ;2;r;g;b        T{
410 24-bit color, r/g/b components are in the range 0..255
414 .B ECMA-48 Mode Switches
416 ESC [ 3 h
417 DECCRM (default off): Display control chars.
419 ESC [ 4 h
420 DECIM (default off): Set insert mode.
422 ESC [ 20 h
423 LF/NL (default off): Automatically follow echo of LF, VT, or FF with CR.
426 .B ECMA-48 Status Report Commands
429 ESC [ 5 n
430 Device status report (DSR): Answer is ESC [ 0 n (Terminal OK).
432 ESC [ 6 n
433 Cursor position report (CPR): Answer is ESC [ \fIy\fP ; \fIx\fP R,
434 where \fIx,y\fP is the cursor location.
437 .B DEC Private Mode (DECSET/DECRST) sequences
440 These are not described in ECMA-48.
441 We list the Set Mode sequences;
442 the Reset Mode sequences are obtained by replacing the final \[aq]h\[aq]
443 by \[aq]l\[aq].
445 ESC [ ? 1 h
446 DECCKM (default off): When set, the cursor keys send an ESC O prefix,
447 rather than ESC [.
449 ESC [ ? 3 h
450 DECCOLM (default off = 80 columns): 80/132 col mode switch.
451 The driver sources note that this alone does not suffice; some user-mode
452 utility such as
453 .BR resizecons (8)
454 has to change the hardware registers on the console video card.
456 ESC [ ? 5 h
457 DECSCNM (default off): Set reverse-video mode.
459 ESC [ ? 6 h
460 DECOM (default off): When set, cursor addressing is relative to
461 the upper left corner of the scrolling region.
463 ESC [ ? 7 h
464 DECAWM (default on): Set autowrap on.
465 In this mode, a graphic
466 character emitted after column 80 (or column 132 of DECCOLM is on)
467 forces a wrap to the beginning of the following line first.
469 ESC [ ? 8 h
470 DECARM (default on): Set keyboard autorepeat on.
472 ESC [ ? 9 h
473 X10 Mouse Reporting (default off): Set reporting mode to 1 (or reset to
474 0)\[em]see below.
476 ESC [ ? 25 h
477 DECTECM (default on): Make cursor visible.
479 ESC [ ? 1000 h
480 X11 Mouse Reporting (default off): Set reporting mode to 2 (or reset
481 to 0)\[em]see below.
484 .B Linux Console Private CSI Sequences
487 The following sequences are neither ECMA-48 nor native VT102.
488 They are native to the Linux console driver.
489 Colors are in SGR parameters:
490 0 = black, 1 = red, 2 = green, 3 = brown, 4 = blue, 5 = magenta, 6 =
491 cyan, 7 = white; 8\[en]15 = bright versions of 0\[en]7.
493 l lx.
494 ESC [ 1 ; \fIn\fP ]     T{
495 Set color \fIn\fP as the underline color.
497 ESC [ 2 ; \fIn\fP ]     T{
498 Set color \fIn\fP as the dim color.
500 ESC [ 8 ]               T{
501 Make the current color pair the default attributes.
503 ESC [ 9 ; \fIn\fP ]     T{
504 Set screen blank timeout to \fIn\fP minutes.
506 ESC [ 10 ; \fIn\fP ]    T{
507 Set bell frequency in Hz.
509 ESC [ 11 ; \fIn\fP ]    T{
510 Set bell duration in msec.
512 ESC [ 12 ; \fIn\fP ]    T{
513 Bring specified console to the front.
515 ESC [ 13 ]              T{
516 Unblank the screen.
518 ESC [ 14 ; \fIn\fP ]    T{
519 Set the VESA powerdown interval in minutes.
521 ESC [ 15 ]      T{
522 Bring the previous console to the front
523 (since Linux 2.6.0).
525 ESC [ 16 ; \fIn\fP ]    T{
526 Set the cursor blink interval in milliseconds
527 (since Linux 4.2).
529 .\" commit bd63364caa8df38bad2b25b11b2a1b849475cce5
531 .SS Character sets
532 The kernel knows about 4 translations of bytes into console-screen
533 symbols.
534 The four tables are: a) Latin1 \-> PC,
535 b) VT100 graphics \-> PC, c) PC \-> PC, d) user-defined.
537 There are two character sets, called G0 and G1, and one of them
538 is the current character set.
539 (Initially G0.)
540 Typing \fB\[ha]N\fP causes G1 to become current,
541 \fB\[ha]O\fP causes G0 to become current.
543 These variables G0 and G1 point at a translation table, and can be
544 changed by the user.
545 Initially they point at tables a) and b), respectively.
546 The sequences ESC ( B and ESC ( 0 and ESC ( U and ESC ( K cause G0 to
547 point at translation table a), b), c), and d), respectively.
548 The sequences ESC ) B and ESC ) 0 and ESC ) U and ESC ) K cause G1 to
549 point at translation table a), b), c), and d), respectively.
551 The sequence ESC c causes a terminal reset, which is what you want if the
552 screen is all garbled.
553 The oft-advised "echo \[ha]V\[ha]O" will make only G0 current,
554 but there is no guarantee that G0 points at table a).
555 In some distributions there is a program
556 .BR reset (1)
557 that just does "echo \[ha][c".
558 If your terminfo entry for the console is correct
559 (and has an entry rs1=\eEc), then "tput reset" will also work.
561 The user-defined mapping table can be set using
562 .BR mapscrn (8).
563 The result of the mapping is that if a symbol c is printed, the symbol
564 s = map[c] is sent to the video memory.
565 The bitmap that corresponds to
566 s is found in the character ROM, and can be changed using
567 .BR setfont (8).
568 .SS Mouse tracking
569 The mouse tracking facility is intended to return
570 .BR xterm (1)-compatible
571 mouse status reports.
572 Because the console driver has no way to know
573 the device or type of the mouse, these reports are returned in the
574 console input stream only when the virtual terminal driver receives
575 a mouse update ioctl.
576 These ioctls must be generated by a mouse-aware
577 user-mode application such as the
578 .BR gpm (8)
579 daemon.
581 The mouse tracking escape sequences generated by
582 \fBxterm\fP(1) encode numeric parameters in a single character as
583 \fIvalue\fP+040.
584 For example, \[aq]!\[aq] is 1.
585 The screen coordinate system is 1-based.
587 The X10 compatibility mode sends an escape sequence on button press
588 encoding the location and the mouse button pressed.
589 It is enabled by sending ESC [ ? 9 h and disabled with ESC [ ? 9 l.
590 On button press, \fBxterm\fP(1) sends
591 ESC [ M \fIbxy\fP (6 characters).
592 Here \fIb\fP is button\-1,
593 and \fIx\fP and \fIy\fP are the x and y coordinates of the mouse
594 when the button was pressed.
595 This is the same code the kernel also produces.
597 Normal tracking mode (not implemented in Linux 2.0.24) sends an escape
598 sequence on both button press and release.
599 Modifier information is also sent.
600 It is enabled by sending ESC [ ? 1000 h and disabled with
601 ESC [ ? 1000 l.
602 On button press or release, \fBxterm\fP(1) sends ESC [ M
603 \fIbxy\fP.
604 The low two bits of \fIb\fP encode button information:
605 0=MB1 pressed, 1=MB2 pressed, 2=MB3 pressed, 3=release.
606 The upper bits encode what modifiers were down when the button was
607 pressed and are added together: 4=Shift, 8=Meta, 16=Control.
608 Again \fIx\fP and
609 \fIy\fP are the x and y coordinates of the mouse event.
610 The upper left corner is (1,1).
611 .SS Comparisons with other terminals
612 Many different terminal types are described, like the Linux console,
613 as being "VT100-compatible".
614 Here we discuss differences between the
615 Linux console and the two most important others, the DEC VT102 and
616 .BR xterm (1).
619 .B Control-character handling
621 The VT102 also recognized the following control characters:
623 NUL (0x00)
624 was ignored;
626 ENQ (0x05)
627 triggered an answerback message;
629 DC1 (0x11, \fB\[ha]Q\fP, XON)
630 resumed transmission;
632 DC3 (0x13, \fB\[ha]S\fP, XOFF)
633 caused VT100 to ignore (and stop transmitting)
634 all codes except XOFF and XON.
636 VT100-like DC1/DC3 processing may be enabled by the terminal driver.
639 .BR xterm (1)
640 program (in VT100 mode) recognizes the control characters
641 BEL, BS, HT, LF, VT, FF, CR, SO, SI, ESC.
644 .B Escape sequences
646 VT100 console sequences not implemented on the Linux console:
648 l l l.
649 ESC N   SS2     T{
650 Single shift 2. (Select G2 character set for the next character only.)
652 ESC O   SS3     T{
653 Single shift 3. (Select G3 character set for the next character only.)
655 ESC P   DCS     T{
656 Device control string (ended by ESC \e)
658 ESC X   SOS     Start of string.
659 ESC \[ha]       PM      Privacy message (ended by ESC \e)
660 ESC \e  ST      String terminator
661 ESC * ...               Designate G2 character set
662 ESC + ...               Designate G3 character set
665 The program
666 .BR xterm (1)
667 (in VT100 mode) recognizes ESC c, ESC # 8, ESC >, ESC =,
668 ESC D, ESC E, ESC H, ESC M, ESC N, ESC O, ESC P ... ESC \e,
669 ESC Z (it answers ESC [ ? 1 ; 2 c, "I am a VT100 with
670 advanced video option")
671 and ESC \[ha] ... ESC \e with the same meanings as indicated above.
672 It accepts ESC (, ESC ), ESC *,  ESC + followed by 0, A, B for
673 the DEC special character and line drawing set, UK, and US-ASCII,
674 respectively.
676 The user can configure \fBxterm\fP(1) to respond to VT220-specific
677 control sequences, and it will identify itself as a VT52, VT100, and
678 up depending on the way it is configured and initialized.
680 It accepts ESC ] (OSC) for the setting of certain resources.
681 In addition to the ECMA-48 string terminator (ST),
682 \fBxterm\fP(1) accepts a BEL to terminate an OSC string.
683 These are a few of the OSC control sequences recognized by \fBxterm\fP(1):
685 l l.
686 ESC ] 0 ; \fItxt\fP ST  T{
687 Set icon name and window title to \fItxt\fP.
689 ESC ] 1 ; \fItxt\fP ST  Set icon name to \fItxt\fP.
690 ESC ] 2 ; \fItxt\fP ST  Set window title to \fItxt\fP.
691 ESC ] 4 ; \fInum\fP; \fItxt\fP ST       Set ANSI color \fInum\fP to \fItxt\fP.
692 ESC ] 10 ; \fItxt\fP ST Set dynamic text color to \fItxt\fP.
693 ESC ] 4 6 ; \fIname\fP ST       T{
694 Change log file to \fIname\fP (normally disabled by a compile-time option).
696 ESC ] 5 0 ; \fIfn\fP ST Set font to \fIfn\fP.
699 It recognizes the following with slightly modified meaning
700 (saving more state, behaving closer to VT100/VT220):
702 l l l.
703 ESC 7  DECSC    Save cursor
704 ESC 8  DECRC    Restore cursor
707 It also recognizes
709 l l lx.
710 ESC F           T{
711 Cursor to lower left corner of screen (if enabled
712 by \fBxterm\fP(1)'s \fBhpLowerleftBugCompat\fP resource).
714 ESC l           Memory lock (per HP terminals).
715                 Locks memory above the cursor.
716 ESC m           Memory unlock (per HP terminals).
717 ESC n   LS2     Invoke the G2 character set.
718 ESC o   LS3     Invoke the G3 character set.
719 ESC |   LS3R    Invoke the G3 character set as GR.
720 ESC }   LS2R    Invoke the G2 character set as GR.
721 ESC \[ti]       LS1R    Invoke the G1 character set as GR.
724 It also recognizes ESC % and provides a more complete UTF-8
725 implementation than Linux console.
728 .B CSI Sequences
730 Old versions of \fBxterm\fP(1), for example, from X11R5,
731 interpret the blink SGR as a bold SGR.
732 Later versions which implemented ANSI colors, for example,
733 XFree86 3.1.2A in 1995, improved this by allowing
734 the blink attribute to be displayed as a color.
735 Modern versions of xterm implement blink SGR as blinking text
736 and still allow colored text as an alternate rendering of SGRs.
737 Stock X11R6 versions did not recognize the color-setting SGRs until
738 the X11R6.8 release, which incorporated XFree86 xterm.
739 All ECMA-48 CSI sequences recognized by Linux are also recognized by
740 .IR xterm ,
741 however \fBxterm\fP(1) implements several ECMA-48 and DEC control sequences
742 not recognized by Linux.
744 The \fBxterm\fP(1)
745 program recognizes all of the DEC Private Mode sequences listed
746 above, but none of the Linux private-mode sequences.
747 For discussion of \fBxterm\fP(1)'s
748 own private-mode sequences, refer to the
749 \fIXterm Control Sequences\fP
750 document by
751 Edward Moy,
752 Stephen Gildea,
753 and Thomas E.\& Dickey
754 available with the X distribution.
755 That document, though terse, is much longer than this manual page.
756 For a chronological overview,
759 .UR http://invisible\-island.net\:/xterm\:/xterm.log.html
763 details changes to xterm.
765 The \fIvttest\fP program
768 .UR http://invisible\-island.net\:/vttest/
772 demonstrates many of these control sequences.
773 The \fBxterm\fP(1) source distribution also contains sample
774 scripts which exercise other features.
775 .SH NOTES
776 ESC 8 (DECRC) is not able to restore the character set changed with
777 ESC %.
778 .SH BUGS
779 In Linux 2.0.23, CSI is broken, and NUL is not ignored inside
780 escape sequences.
782 Some older kernel versions (after Linux 2.0) interpret 8-bit control
783 sequences.
784 These "C1 controls" use codes between 128 and 159 to replace
785 ESC [, ESC ] and similar two-byte control sequence initiators.
786 There are fragments of that in modern kernels (either overlooked or
787 broken by changes to support UTF-8),
788 but the implementation is incomplete and should be regarded
789 as unreliable.
791 Linux "private mode" sequences do not follow the rules in ECMA-48
792 for private mode control sequences.
793 In particular, those ending with ] do not use a standard terminating
794 character.
795 The OSC (set palette) sequence is a greater problem,
796 since \fBxterm\fP(1) may interpret this as a control sequence
797 which requires a string terminator (ST).
798 Unlike the \fBsetterm\fP(1) sequences which will be ignored (since
799 they are invalid control sequences), the palette sequence will make
800 \fBxterm\fP(1) appear to hang (though pressing the return-key
801 will fix that).
802 To accommodate applications which have been hardcoded to use Linux
803 control sequences,
804 set the \fBxterm\fP(1) resource \fBbrokenLinuxOSC\fP to true.
806 An older version of this document implied that Linux recognizes the
807 ECMA-48 control sequence for invisible text.
808 It is ignored.
809 .SH SEE ALSO
810 .BR ioctl_console (2),
811 .BR charsets (7)