Debian Codegraph @

upstream/debian-unstable/man4/console_codes.4

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