mount_namespaces.7: Add further details on locked mounts in a less-privileged user...
[man-pages.git] / man4 / console_codes.4
blobd549b76a9a8ad1d075000819f3031f15839fb253
1 .\" Copyright (c) 1996 Andries Brouwer <aeb@cwi.nl>, Mon Oct 31 22:13:04 1996
2 .\"
3 .\" %%%LICENSE_START(GPLv2+_DOC_ONEPARA)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
8 .\" %%%LICENSE_END
9 .\"
10 .\" This is combined from many sources.
11 .\" For Linux, the definitive source is of course console.c.
12 .\" About vt100-like escape sequences in general there are
13 .\" the ISO 6429 and ISO 2022 norms, the descriptions of
14 .\" an actual vt100, and the xterm docs (ctlseqs.ms).
15 .\" Substantial portions of this text are derived from a write-up
16 .\" by Eric S. Raymond <esr@thyrsus.com>.
17 .\"
18 .\" Tiny correction, aeb, 961107.
19 .\"
20 .\" 2006-05-27, Several corrections - Thomas E. Dickey
21 .\"
22 .TH CONSOLE_CODES 4 2021-03-22 "Linux" "Linux Programmer's Manual"
23 .SH NAME
24 console_codes \- Linux console escape and control sequences
25 .SH DESCRIPTION
26 The Linux console implements a large subset of the VT102 and ECMA-48/ISO
27 6429/ANSI X3.64 terminal controls, plus certain private-mode sequences
28 for changing the color palette, character-set mapping, and so on.
29 In the tabular descriptions below, the second column gives ECMA-48 or DEC
30 mnemonics (the latter if prefixed with DEC) for the given function.
31 Sequences without a mnemonic are neither ECMA-48 nor VT102.
32 .PP
33 After all the normal output processing has been done, and a
34 stream of characters arrives at the console driver for actual
35 printing, the first thing that happens is a translation from
36 the code used for processing to the code used for printing.
37 .PP
38 If the console is in UTF-8 mode, then the incoming bytes are
39 first assembled into 16-bit Unicode codes.
40 Otherwise, each byte is transformed according to the current mapping table
41 (which translates it to a Unicode value).
42 See the \fBCharacter Sets\fP section below for discussion.
43 .PP
44 In the normal case, the Unicode value is converted to a font index,
45 and this is stored in video memory, so that the corresponding glyph
46 (as found in video ROM) appears on the screen.
47 Note that the use of Unicode (and the design of the PC hardware)
48 allows us to use 512 different glyphs simultaneously.
49 .PP
50 If the current Unicode value is a control character, or we are
51 currently processing an escape sequence, the value will treated
52 specially.
53 Instead of being turned into a font index and rendered as
54 a glyph, it may trigger cursor movement or other control functions.
55 See the \fBLinux Console Controls\fP section below for discussion.
56 .PP
57 It is generally not good practice to hard-wire terminal controls into
58 programs.
59 Linux supports a
60 .BR terminfo (5)
61 database of terminal capabilities.
62 Rather than emitting console escape sequences by hand, you will almost
63 always want to use a terminfo-aware screen library or utility such as
64 .BR ncurses (3),
65 .BR tput (1),
67 .BR reset (1).
68 .SS Linux console controls
69 This section describes all the control characters and escape sequences
70 that invoke special functions (i.e., anything other than writing a
71 glyph at the current cursor location) on the Linux console.
72 .PP
73 .B "Control characters"
74 .PP
75 A character is a control character if (before transformation
76 according to the mapping table) it has one of the 14 codes
77 00 (NUL), 07 (BEL), 08 (BS), 09 (HT), 0a (LF), 0b (VT),
78 0c (FF), 0d (CR), 0e (SO), 0f (SI), 18 (CAN), 1a (SUB),
79 1b (ESC), 7f (DEL).
80 One can set a "display control characters" mode (see below),
81 and allow 07, 09, 0b, 18, 1a, 7f to be displayed as glyphs.
82 On the other hand, in UTF-8 mode all codes 00\(en1f are regarded
83 as control characters, regardless of any "display control characters"
84 mode.
85 .PP
86 If we have a control character, it is acted upon immediately
87 and then discarded (even in the middle of an escape sequence)
88 and the escape sequence continues with the next character.
89 (However, ESC starts a new escape sequence, possibly aborting a previous
90 unfinished one, and CAN and SUB abort any escape sequence.)
91 The recognized control characters are BEL, BS, HT, LF, VT, FF,
92 CR, SO, SI, CAN, SUB, ESC, DEL, CSI.
93 They do what one would expect:
94 .HP
95 BEL (0x07, \fB\(haG\fP) beeps;
96 .HP
97 BS (0x08, \fB\(haH\fP) backspaces one column
98 (but not past the beginning of the line);
99 .HP
100 HT (0x09, \fB\(haI\fP) 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\(haJ\fP), VT (0x0B, \fB\(haK\fP), and
104 FF (0x0C, \fB\(haL\fP) all give a linefeed,
105 and if LF/NL (new-line mode) is set also a carriage return;
107 CR (0x0D, \fB\(haM\fP) gives a carriage return;
109 SO (0x0E, \fB\(haN\fP) activates the G1 character set;
111 SI (0x0F, \fB\(haO\fP) activates the G0 character set;
113 CAN (0x18, \fB\(haX\fP) and SUB (0x1A, \fB\(haZ\fP) abort escape sequences;
115 ESC (0x1B, \fB\(ha[\fP) starts an escape sequence;
117 DEL (0x7F) is ignored;
119 CSI (0x9B) is equivalent to ESC [.
121 .B "ESC- but not CSI-sequences"
122 .ad l
124 l l lx.
125 ESC c   RIS     Reset.
126 ESC D   IND     Linefeed.
127 ESC E   NEL     Newline.
128 ESC H   HTS     Set tab stop at current column.
129 ESC M   RI      Reverse linefeed.
130 ESC Z   DECID   T{
131 DEC private identification. The kernel
132 returns the string  ESC [ ? 6 c, claiming
133 that it is a VT102.
135 ESC 7   DECSC   T{
136 Save current state (cursor coordinates,
137 attributes, character sets pointed at by G0, G1).
139 ESC 8   DECRC   T{
140 Restore state most recently saved by ESC 7.
142 ESC [   CSI     Control sequence introducer
143 ESC %           Start sequence selecting character set
144 ESC % @         \0\0\0Select default (ISO 646 / ISO 8859-1)
145 ESC % G         \0\0\0Select UTF-8
146 ESC % 8         \0\0\0Select UTF-8 (obsolete)
147 ESC # 8 DECALN  T{
148 DEC screen alignment test \- fill screen with E's
150 ESC (           T{
151 Start sequence defining G0 character set
152 (followed by one of B, 0, U, K, as below)
154 ESC ( B         T{
155 Select default (ISO 8859-1 mapping)
157 ESC ( 0         T{
158 Select VT100 graphics mapping
160 ESC ( U         T{
161 Select null mapping \- straight to character ROM
163 ESC ( K         T{
164 Select user mapping \- the map that is loaded by the utility \fBmapscrn\fP(8)
166 ESC )           T{
167 Start sequence defining G1 (followed by one of B, 0, U, K, as above).
169 ESC >   DECPNM  Set numeric keypad mode
170 ESC =   DECPAM  Set application keypad mode
171 ESC ]   OSC     T{
172 (Should be: Operating system command)
173 ESC ] P \fInrrggbb\fP: set palette, with parameter
174 given in 7 hexadecimal digits after the final P :-(.
175 Here \fIn\fP is the color (0\(en15), and \fIrrggbb\fP indicates
176 the red/green/blue values (0\(en255).
177 ESC ] R: reset palette
182 .B "ECMA-48 CSI sequences"
184 CSI (or ESC [) is followed by a sequence of parameters,
185 at most NPAR (16), that are decimal numbers separated by
186 semicolons.
187 An empty or absent parameter is taken to be 0.
188 The sequence of parameters may be preceded by a single question mark.
190 However, after CSI [ (or ESC [ [) a single character is read
191 and this entire sequence is ignored.
192 (The idea is to ignore an echoed function key.)
194 The action of a CSI sequence is determined by its final character.
195 .ad l
197 l l lx.
198 @       ICH     T{
199 Insert the indicated # of blank characters.
201 A       CUU     T{
202 Move cursor up the indicated # of rows.
204 B       CUD     T{
205 Move cursor down the indicated # of rows.
207 C       CUF     T{
208 Move cursor right the indicated # of columns.
210 D       CUB     T{
211 Move cursor left the indicated # of columns.
213 E       CNL     T{
214 Move cursor down the indicated # of rows, to column 1.
216 F       CPL     T{
217 Move cursor up the indicated # of rows, to column 1.
219 G       CHA     T{
220 Move cursor to indicated column in current row.
222 H       CUP     T{
223 Move cursor to the indicated row, column (origin at 1,1).
225 J       ED      T{
226 Erase display (default: from cursor to end of display).
228                 T{
229 ESC [ 1 J: erase from start to cursor.
231                 T{
232 ESC [ 2 J: erase whole display.
234                 T{
235 ESC [ 3 J: erase whole display including scroll-back
236 buffer (since Linux 3.0).
238 .\" ESC [ 3 J: commit f8df13e0a901fe55631fed66562369b4dba40f8b
239 K       EL      T{
240 Erase line (default: from cursor to end of line).
242                 T{
243 ESC [ 1 K: erase from start of line to cursor.
245                 T{
246 ESC [ 2 K: erase whole line.
248 L       IL      T{
249 Insert the indicated # of blank lines.
251 M       DL      T{
252 Delete the indicated # of lines.
254 P       DCH     T{
255 Delete the indicated # of characters on current line.
257 X       ECH     T{
258 Erase the indicated # of characters on current line.
260 a       HPR     T{
261 Move cursor right the indicated # of columns.
263 c       DA      T{
264 Answer ESC [ ? 6 c: "I am a VT102".
266 d       VPA     T{
267 Move cursor to the indicated row, current column.
269 e       VPR     T{
270 Move cursor down the indicated # of rows.
272 f       HVP     T{
273 Move cursor to the indicated row, column.
275 g       TBC     T{
276 Without parameter: clear tab stop at current position.
278                 T{
279 ESC [ 3 g: delete all tab stops.
281 h       SM      Set Mode (see below).
282 l       RM      Reset Mode (see below).
283 m       SGR     Set attributes (see below).
284 n       DSR     Status report (see below).
285 q       DECLL   Set keyboard LEDs.
286                 ESC [ 0 q: clear all LEDs
287                 ESC [ 1 q: set Scroll Lock LED
288                 ESC [ 2 q: set Num Lock LED
289                 ESC [ 3 q: set Caps Lock LED
290 r       DECSTBM T{
291 Set scrolling region; parameters are top and bottom row.
293 s       ?       Save cursor location.
294 u       ?       Restore cursor location.
295 \`      HPA     T{
296 Move cursor to indicated column in current row.
301 .B ECMA-48 Select Graphic Rendition
303 The ECMA-48 SGR sequence ESC [ \fIparameters\fP m sets display
304 attributes.
305 Several attributes can be set in the same sequence, separated by
306 semicolons.
307 An empty parameter (between semicolons or string initiator or
308 terminator) is interpreted as a zero.
309 .ad l
311 l lx.
312 param   result
313 0       T{
314 reset all attributes to their defaults
316 1       set bold
317 2       T{
318 set half-bright (simulated with color on a color display)
320 4       T{
321 set underscore (simulated with color on a color display)
322 (the colors used to simulate dim or underline are set
323 using ESC ] ...)
325 5       set blink
326 7       set reverse video
327 10      T{
328 reset selected mapping, display control flag,
329 and toggle meta flag (ECMA-48 says "primary font").
331 11      T{
332 select null mapping, set display control flag,
333 reset toggle meta flag (ECMA-48 says "first alternate font").
335 12      T{
336 select null mapping, set display control flag,
337 set toggle meta flag (ECMA-48 says "second alternate font").
338 The toggle meta flag
339 causes the high bit of a byte to be toggled
340 before the mapping table translation is done.
342 21      T{
343 set underline; before Linux 4.17, this value
344 set normal intensity (as is done in many other terminals)
346 22      set normal intensity
347 24      underline off
348 25      blink off
349 27      reverse video off
350 30      set black foreground
351 31      set red foreground
352 32      set green foreground
353 33      set brown foreground
354 34      set blue foreground
355 35      set magenta foreground
356 36      set cyan foreground
357 37      set white foreground
358 38      T{
359 256/24-bit foreground color follows, shoehorned into 16 basic colors
360 (before Linux 3.16: set underscore on, set default foreground color)
362 39      T{
363 set default foreground color
364 (before Linux 3.16: set underscore off, set default foreground color)
366 40      set black background
367 41      set red background
368 42      set green background
369 43      set brown background
370 44      set blue background
371 45      set magenta background
372 46      set cyan background
373 47      set white background
374 48      T{
375 256/24-bit background color follows, shoehorned into 8 basic colors
377 49      set default background color
378 90..97  T{
379 set foreground to bright versions of 30..37
381 100.107 T{
382 set background, same as 40..47 (bright not supported)
387 Commands 38 and 48 require further arguments:
389 l lx.
390 ;5;x    T{
391 256 color: values 0..15 are IBGR (black, red, green, ... white),
392 16..231 a 6x6x6 color cube, 232..255 a grayscale ramp
394 ;2;r;g;b        T{
395 24-bit color, r/g/b components are in the range 0..255
399 .B ECMA-48 Mode Switches
401 ESC [ 3 h
402 DECCRM (default off): Display control chars.
404 ESC [ 4 h
405 DECIM (default off): Set insert mode.
407 ESC [ 20 h
408 LF/NL (default off): Automatically follow echo of LF, VT, or FF with CR.
411 .B ECMA-48 Status Report Commands
414 ESC [ 5 n
415 Device status report (DSR): Answer is ESC [ 0 n (Terminal OK).
417 ESC [ 6 n
418 Cursor position report (CPR): Answer is ESC [ \fIy\fP ; \fIx\fP R,
419 where \fIx,y\fP is the cursor location.
422 .B DEC Private Mode (DECSET/DECRST) sequences
425 These are not described in ECMA-48.
426 We list the Set Mode sequences;
427 the Reset Mode sequences are obtained by replacing the final \(aqh\(aq
428 by \(aql\(aq.
430 ESC [ ? 1 h
431 DECCKM (default off): When set, the cursor keys send an ESC O prefix,
432 rather than ESC [.
434 ESC [ ? 3 h
435 DECCOLM (default off = 80 columns): 80/132 col mode switch.
436 The driver sources note that this alone does not suffice; some user-mode
437 utility such as
438 .BR resizecons (8)
439 has to change the hardware registers on the console video card.
441 ESC [ ? 5 h
442 DECSCNM (default off): Set reverse-video mode.
444 ESC [ ? 6 h
445 DECOM (default off): When set, cursor addressing is relative to
446 the upper left corner of the scrolling region.
448 ESC [ ? 7 h
449 DECAWM (default on): Set autowrap on.
450 In this mode, a graphic
451 character emitted after column 80 (or column 132 of DECCOLM is on)
452 forces a wrap to the beginning of the following line first.
454 ESC [ ? 8 h
455 DECARM (default on): Set keyboard autorepeat on.
457 ESC [ ? 9 h
458 X10 Mouse Reporting (default off): Set reporting mode to 1 (or reset to
459 0)\(emsee below.
461 ESC [ ? 25 h
462 DECTECM (default on): Make cursor visible.
464 ESC [ ? 1000 h
465 X11 Mouse Reporting (default off): Set reporting mode to 2 (or reset
466 to 0)\(emsee below.
469 .B Linux Console Private CSI Sequences
472 The following sequences are neither ECMA-48 nor native VT102.
473 They are native to the Linux console driver.
474 Colors are in SGR parameters:
475 0 = black, 1 = red, 2 = green, 3 = brown, 4 = blue, 5 = magenta, 6 =
476 cyan, 7 = white; 8\(en15 = bright versions of 0\(en7.
478 l lx.
479 ESC [ 1 ; \fIn\fP ]     T{
480 Set color \fIn\fP as the underline color.
482 ESC [ 2 ; \fIn\fP ]     T{
483 Set color \fIn\fP as the dim color.
485 ESC [ 8 ]               T{
486 Make the current color pair the default attributes.
488 ESC [ 9 ; \fIn\fP ]     T{
489 Set screen blank timeout to \fIn\fP minutes.
491 ESC [ 10 ; \fIn\fP ]    T{
492 Set bell frequency in Hz.
494 ESC [ 11 ; \fIn\fP ]    T{
495 Set bell duration in msec.
497 ESC [ 12 ; \fIn\fP ]    T{
498 Bring specified console to the front.
500 ESC [ 13 ]              T{
501 Unblank the screen.
503 ESC [ 14 ; \fIn\fP ]    T{
504 Set the VESA powerdown interval in minutes.
506 ESC [ 15 ]      T{
507 Bring the previous console to the front
508 (since Linux 2.6.0).
510 ESC [ 16 ; \fIn\fP ]    T{
511 Set the cursor blink interval in milliseconds
512 (since Linux 4.2).
514 .\" commit bd63364caa8df38bad2b25b11b2a1b849475cce5
516 .SS Character sets
517 The kernel knows about 4 translations of bytes into console-screen
518 symbols.
519 The four tables are: a) Latin1 \-> PC,
520 b) VT100 graphics \-> PC, c) PC \-> PC, d) user-defined.
522 There are two character sets, called G0 and G1, and one of them
523 is the current character set.
524 (Initially G0.)
525 Typing \fB\(haN\fP causes G1 to become current,
526 \fB\(haO\fP causes G0 to become current.
528 These variables G0 and G1 point at a translation table, and can be
529 changed by the user.
530 Initially they point at tables a) and b), respectively.
531 The sequences ESC ( B and ESC ( 0 and ESC ( U and ESC ( K cause G0 to
532 point at translation table a), b), c), and d), respectively.
533 The sequences ESC ) B and ESC ) 0 and ESC ) U and ESC ) K cause G1 to
534 point at translation table a), b), c), and d), respectively.
536 The sequence ESC c causes a terminal reset, which is what you want if the
537 screen is all garbled.
538 The oft-advised "echo \(haV\(haO" will make only G0 current,
539 but there is no guarantee that G0 points at table a).
540 In some distributions there is a program
541 .BR reset (1)
542 that just does "echo \(ha[c".
543 If your terminfo entry for the console is correct
544 (and has an entry rs1=\eEc), then "tput reset" will also work.
546 The user-defined mapping table can be set using
547 .BR mapscrn (8).
548 The result of the mapping is that if a symbol c is printed, the symbol
549 s = map[c] is sent to the video memory.
550 The bitmap that corresponds to
551 s is found in the character ROM, and can be changed using
552 .BR setfont (8).
553 .SS Mouse tracking
554 The mouse tracking facility is intended to return
555 .BR xterm (1)-compatible
556 mouse status reports.
557 Because the console driver has no way to know
558 the device or type of the mouse, these reports are returned in the
559 console input stream only when the virtual terminal driver receives
560 a mouse update ioctl.
561 These ioctls must be generated by a mouse-aware
562 user-mode application such as the
563 .BR gpm (8)
564 daemon.
566 The mouse tracking escape sequences generated by
567 \fBxterm\fP(1) encode numeric parameters in a single character as
568 \fIvalue\fP+040.
569 For example, \(aq!\(aq is 1.
570 The screen coordinate system is 1-based.
572 The X10 compatibility mode sends an escape sequence on button press
573 encoding the location and the mouse button pressed.
574 It is enabled by sending ESC [ ? 9 h and disabled with ESC [ ? 9 l.
575 On button press, \fBxterm\fP(1) sends
576 ESC [ M \fIbxy\fP (6 characters).
577 Here \fIb\fP is button\-1,
578 and \fIx\fP and \fIy\fP are the x and y coordinates of the mouse
579 when the button was pressed.
580 This is the same code the kernel also produces.
582 Normal tracking mode (not implemented in Linux 2.0.24) sends an escape
583 sequence on both button press and release.
584 Modifier information is also sent.
585 It is enabled by sending ESC [ ? 1000 h and disabled with
586 ESC [ ? 1000 l.
587 On button press or release, \fBxterm\fP(1) sends ESC [ M
588 \fIbxy\fP.
589 The low two bits of \fIb\fP encode button information:
590 0=MB1 pressed, 1=MB2 pressed, 2=MB3 pressed, 3=release.
591 The upper bits encode what modifiers were down when the button was
592 pressed and are added together: 4=Shift, 8=Meta, 16=Control.
593 Again \fIx\fP and
594 \fIy\fP are the x and y coordinates of the mouse event.
595 The upper left corner is (1,1).
596 .SS Comparisons with other terminals
597 Many different terminal types are described, like the Linux console,
598 as being "VT100-compatible".
599 Here we discuss differences between the
600 Linux console and the two most important others, the DEC VT102 and
601 .BR xterm (1).
604 .B Control-character handling
606 The VT102 also recognized the following control characters:
608 NUL (0x00) was ignored;
610 ENQ (0x05) triggered an answerback message;
612 DC1 (0x11, \fB\(haQ\fP, XON) resumed transmission;
614 DC3 (0x13, \fB\(haS\fP, XOFF) caused VT100 to ignore (and stop transmitting)
615 all codes except XOFF and XON.
617 VT100-like DC1/DC3 processing may be enabled by the terminal driver.
620 .BR xterm (1)
621 program (in VT100 mode) recognizes the control characters
622 BEL, BS, HT, LF, VT, FF, CR, SO, SI, ESC.
625 .B Escape sequences
627 VT100 console sequences not implemented on the Linux console:
629 l l l.
630 ESC N   SS2     T{
631 Single shift 2. (Select G2 character set for the next character only.)
633 ESC O   SS3     T{
634 Single shift 3. (Select G3 character set for the next character only.)
636 ESC P   DCS     T{
637 Device control string (ended by ESC \e)
639 ESC X   SOS     Start of string.
640 ESC \(ha        PM      Privacy message (ended by ESC \e)
641 ESC \e  ST      String terminator
642 ESC * ...               Designate G2 character set
643 ESC + ...               Designate G3 character set
646 The program
647 .BR xterm (1)
648 (in VT100 mode) recognizes ESC c, ESC # 8, ESC >, ESC =,
649 ESC D, ESC E, ESC H, ESC M, ESC N, ESC O, ESC P ... ESC \e,
650 ESC Z (it answers ESC [ ? 1 ; 2 c, "I am a VT100 with
651 advanced video option")
652 and ESC \(ha ... ESC \e with the same meanings as indicated above.
653 It accepts ESC (, ESC ), ESC *,  ESC + followed by 0, A, B for
654 the DEC special character and line drawing set, UK, and US-ASCII,
655 respectively.
657 The user can configure \fBxterm\fP(1) to respond to VT220-specific
658 control sequences, and it will identify itself as a VT52, VT100, and
659 up depending on the way it is configured and initialized.
661 It accepts ESC ] (OSC) for the setting of certain resources.
662 In addition to the ECMA-48 string terminator (ST),
663 \fBxterm\fP(1) accepts a BEL to terminate an OSC string.
664 These are a few of the OSC control sequences recognized by \fBxterm\fP(1):
666 l l.
667 ESC ] 0 ; \fItxt\fP ST  T{
668 Set icon name and window title to \fItxt\fP.
670 ESC ] 1 ; \fItxt\fP ST  Set icon name to \fItxt\fP.
671 ESC ] 2 ; \fItxt\fP ST  Set window title to \fItxt\fP.
672 ESC ] 4 ; \fInum\fP; \fItxt\fP ST       Set ANSI color \fInum\fP to \fItxt\fP.
673 ESC ] 10 ; \fItxt\fP ST Set dynamic text color to \fItxt\fP.
674 ESC ] 4 6 ; \fIname\fP ST       T{
675 Change log file to \fIname\fP (normally disabled by a compile-time option).
677 ESC ] 5 0 ; \fIfn\fP ST Set font to \fIfn\fP.
680 It recognizes the following with slightly modified meaning
681 (saving more state, behaving closer to VT100/VT220):
683 l l l.
684 ESC 7  DECSC    Save cursor
685 ESC 8  DECRC    Restore cursor
688 It also recognizes
690 l l lx.
691 ESC F           T{
692 Cursor to lower left corner of screen (if enabled
693 by \fBxterm\fP(1)'s \fBhpLowerleftBugCompat\fP resource)
695 ESC l           Memory lock (per HP terminals).
696                 Locks memory above the cursor.
697 ESC m           Memory unlock (per HP terminals).
698 ESC n   LS2     Invoke the G2 character set.
699 ESC o   LS3     Invoke the G3 character set.
700 ESC |   LS3R    Invoke the G3 character set as GR.
701 ESC }   LS2R    Invoke the G2 character set as GR.
702 ESC \(ti        LS1R    Invoke the G1 character set as GR.
705 It also recognizes ESC % and provides a more complete UTF-8
706 implementation than Linux console.
709 .B CSI Sequences
711 Old versions of \fBxterm\fP(1), for example, from X11R5,
712 interpret the blink SGR as a bold SGR.
713 Later versions which implemented ANSI colors, for example,
714 XFree86 3.1.2A in 1995, improved this by allowing
715 the blink attribute to be displayed as a color.
716 Modern versions of xterm implement blink SGR as blinking text
717 and still allow colored text as an alternate rendering of SGRs.
718 Stock X11R6 versions did not recognize the color-setting SGRs until
719 the X11R6.8 release, which incorporated XFree86 xterm.
720 All ECMA-48 CSI sequences recognized by Linux are also recognized by
721 .IR xterm ,
722 however \fBxterm\fP(1) implements several ECMA-48 and DEC control sequences
723 not recognized by Linux.
725 The \fBxterm\fP(1)
726 program recognizes all of the DEC Private Mode sequences listed
727 above, but none of the Linux private-mode sequences.
728 For discussion of \fBxterm\fP(1)'s
729 own private-mode sequences, refer to the
730 \fIXterm Control Sequences\fP
731 document by
732 Edward Moy,
733 Stephen Gildea,
734 and Thomas E.\& Dickey
735 available with the X distribution.
736 That document, though terse, is much longer than this manual page.
737 For a chronological overview,
740 .UR http://invisible\-island.net\:/xterm\:/xterm.log.html
744 details changes to xterm.
746 The \fIvttest\fP program
749 .UR http://invisible\-island.net\:/vttest/
753 demonstrates many of these control sequences.
754 The \fBxterm\fP(1) source distribution also contains sample
755 scripts which exercise other features.
756 .SH NOTES
757 ESC 8 (DECRC) is not able to restore the character set changed with
758 ESC %.
759 .SH BUGS
760 In 2.0.23, CSI is broken, and NUL is not ignored inside
761 escape sequences.
763 Some older kernel versions (after 2.0) interpret 8-bit control
764 sequences.
765 These "C1 controls" use codes between 128 and 159 to replace
766 ESC [, ESC ] and similar two-byte control sequence initiators.
767 There are fragments of that in modern kernels (either overlooked or
768 broken by changes to support UTF-8),
769 but the implementation is incomplete and should be regarded
770 as unreliable.
772 Linux "private mode" sequences do not follow the rules in ECMA-48
773 for private mode control sequences.
774 In particular, those ending with ] do not use a standard terminating
775 character.
776 The OSC (set palette) sequence is a greater problem,
777 since \fBxterm\fP(1) may interpret this as a control sequence
778 which requires a string terminator (ST).
779 Unlike the \fBsetterm\fP(1) sequences which will be ignored (since
780 they are invalid control sequences), the palette sequence will make
781 \fBxterm\fP(1) appear to hang (though pressing the return-key
782 will fix that).
783 To accommodate applications which have been hardcoded to use Linux
784 control sequences,
785 set the \fBxterm\fP(1) resource \fBbrokenLinuxOSC\fP to true.
787 An older version of this document implied that Linux recognizes the
788 ECMA-48 control sequence for invisible text.
789 It is ignored.
790 .SH SEE ALSO
791 .BR ioctl_console (2),
792 .BR charsets (7)