console_codes(4)
console_codes(4) β Linux console escape and control sequences π
okay bestie, welcome to console_codes(4) from the Kernel Interfaces Manual. This is the whole lore on Linux console escape and control sequences. Letβs get into it, fr fr. β¨
π NAME π
console_codes β Linux console escape and control sequences
π¦ DESCRIPTION π¦
The Linux console implements a large subset of the VT102 and ECMA-48 / ISO/IEC 6429 / ANSI X3.64 terminal controls, plus certain private-mode sequences for changing the color palette, character-set mapping, and so on. In the tabular descriptions below, the second column gives ECMA-48 or DEC mnemonics (the latter if prefixed with DEC) for the given function. Sequences without a mnemonic are neither ECMA-48 nor VT102.
After all the normal output processing has been done, and a stream of characters arrives at the console driver for actual printing, the first thing that happens is a translation from the code used for processing to the code used for printing.
If the console is in UTF-8 mode, then the incoming bytes are first assembled into 16-bit Unicode codes. Otherwise, each byte is transformed according to the current mapping table (which translates it to a Unicode value). See the Character Sets section below for discussion.
In the normal case, the Unicode value is converted to a font index, and this is stored in video memory, so that the corresponding glyph (as found in video ROM) appears on the screen. Note that the use of Unicode (and the design of the PC hardware) allows us to use 512 different glyphs simultaneously.
If the current Unicode value is a control character, or we are currently processing an escape sequence, the value will treated specially. Instead of being turned into a font index and rendered as a glyph, it may trigger cursor movement or other control functions. See the Linux Console Controls section below for discussion.
It is generally not good practice to hard-wire terminal controls into programs. Linux supports a terminfo(5) database of terminal capabilities. Rather than emitting console escape sequences by hand, you will almost always want to use a terminfo-aware screen library or utility such as ncurses(3), tput(1), or reset(1).
π Linux console controls π
This section describes all the control characters and escape sequences that invoke special functions (i.e., anything other than writing a glyph at the current cursor location) on the Linux console.
πΈ Control characters πΈ
A character is a control character if (before transformation according to the mapping table) it has one of the 14 codes 00 (NUL), 07 (BEL), 08 (BS), 09 (HT), 0a (LF), 0b (VT), 0c (FF), 0d (CR), 0e (SO), 0f (SI), 18 (CAN), 1a (SUB), 1b (ESC), 7f (DEL). One can set a "display control characters" mode (see below), and allow 07, 09, 0b, 18, 1a, 7f to be displayed as glyphs. On the other hand, in UTF-8 mode all codes 00β1f are regarded as control characters, regardless of any "display control characters" mode.
If we have a control character, it is acted upon immediately and then discarded (even in the middle of an escape sequence) and the escape sequence continues with the next character. (However, ESC starts a new escape sequence, possibly aborting a previous unfinished one, and CAN and SUB abort any escape sequence.) The recognized control characters are BEL, BS, HT, LF, VT, FF, CR, SO, SI, CAN, SUB, ESC, DEL, CSI. They do what one would expect:
BEL(0x07,^G) β beeps;BS(0x08,^H) β backspaces one column (but not past the beginning of the line);HT(0x09,^I) β goes to the next tab stop or to the end of the line if there is no earlier tab stop;LF(0x0A,^J),VT(0x0B,^K),FF(0x0C,^L) β all give a linefeed, and if LF/NL (new-line mode) is set also a carriage return;CR(0x0D,^M) β gives a carriage return;SO(0x0E,^N) β activates the G1 character set;SI(0x0F,^O) β activates the G0 character set;CAN(0x18,^X),SUB(0x1A,^Z) β abort escape sequences;ESC(0x1B,^[) β starts an escape sequence;DEL(0x7F) β is ignored;CSI(0x9B) β is equivalent toESC [.
π¦ ESC- but not CSI-sequences π¦
ESC cβRISβ Reset.ESC DβINDβ Linefeed.ESC EβNELβ Newline.ESC HβHTSβ Set tab stop at current column.ESC MβRIβ Reverse linefeed.ESC ZβDECIDβ DEC private identification. The kernel returns the stringESC [ ? 6 c, claiming that it is aVT102.ESC 7βDECSCβ Save current state (cursor coordinates, attributes, character sets pointed at by G0, G1).ESC 8βDECRCβ Restore state most recently saved byESC 7.ESC %β Start sequence selecting character setESC % @β Select default (ISO/IEC 646/ISO/IEC 8859-1)ESC % Gβ Select UTF-8ESC % 8β Select UTF-8 (obsolete)
ESC # 8βDECALNβ DEC screen alignment test - fill screen with E's.ESC (β Start sequence defining G0 character set (followed by one ofB,0,U,K, as below)ESC ( Bβ Select default (ISO/IEC 8859-1mapping).ESC ( 0β Select VT100 graphics mapping.ESC ( Uβ Select null mapping - straight to character ROM.ESC ( Kβ Select user mapping - the map that is loaded by the utilitymapscrn(8).
ESC )β Start sequence defining G1 (followed by one ofB,0,U,K, as above).ESC >βDECPNMβ Set numeric keypad modeESC =βDECPAMβ Set application keypad modeESC ]βOSCβ Operating System Command prefix.ESC ] Rβ Reset palette.ESC ] Pβ Set palette, with parameter given in 7 hexadecimal digitsnrrggbbafter the finalP. Here n is the color (0β15), andrrggbbindicates the red/green/blue values (0β255).
β¨ ECMA-48 CSI sequences β¨
CSI (or ESC [) is followed by a sequence of parameters, at most NPAR (16), that are decimal numbers separated by semicolons. An empty or absent parameter is taken to be 0. The sequence of parameters may be preceded by a single question mark.
However, after CSI [ (or ESC [ [) a single character is read and this entire sequence is ignored. (The idea is to ignore an echoed function key.)
The action of a CSI sequence is determined by its final character.
@βICHβ Insert the indicated#of blank characters.AβCUUβ Move cursor up the indicated#of rows.BβCUDβ Move cursor down the indicated#of rows.CβCUFβ Move cursor right the indicated#of columns.DβCUBβ Move cursor left the indicated#of columns.EβCNLβ Move cursor down the indicated#of rows, to column 1.FβCPLβ Move cursor up the indicated#of rows, to column 1.GβCHAβ Move cursor to indicated column in current row.HβCUPβ Move cursor to the indicated row, column (origin at 1,1).JβEDβ Erase display (default: from cursor to end of display).ESC [ 1 J: erase from start to cursor.ESC [ 2 J: erase whole display.ESC [ 3 J: erase whole display including scroll-back buffer (since Linux 3.0).
KβELβ Erase line (default: from cursor to end of line).ESC [ 1 K: erase from start of line to cursor.ESC [ 2 K: erase whole line.
LβILβ Insert the indicated#of blank lines.MβDLβ Delete the indicated#of lines.PβDCHβ Delete the indicated#of characters on current line.XβECHβ Erase the indicated#of characters on current line.aβHPRβ Move cursor right the indicated#of columns.cβDAβ AnswerESC [ ? 6 c: "I am a VT102".dβVPAβ Move cursor to the indicated row, current column.eβVPRβ Move cursor down the indicated#of rows.fβHVPβ Move cursor to the indicated row, column.gβTBCβ Without parameter: clear tab stop at current position.ESC [ 3 g: delete all tab stops.
hβSMβ Set Mode (see below).lβRMβ Reset Mode (see below).mβSGRβ Set attributes (see below).nβDSRβ Status report (see below).qβDECLLβ Set keyboard LEDs.ESC [ 0 q: clear all LEDsESC [ 1 q: set Scroll Lock LEDESC [ 2 q: set Num Lock LEDESC [ 3 q: set Caps Lock LED
rβDECSTBMβ Set scrolling region; parameters are top and bottom row.sβSCOSCβ Save cursor location.uβSCORCβ Restore cursor location.`βHPAβ Move cursor to indicated column in current row.
π ECMA-48 Select Graphic Rendition π
The ECMA-48 SGR sequence ESC [ parameters m sets display attributes. Several attributes can be set in the same sequence, separated by semicolons. An empty parameter (between semicolons or string initiator or terminator) is interpreted as a zero.
okay bestie, so you know how <pink>ESC [ ... m</pink> sets your text attributes? These are the numbers that go in the ... and what they do:
0β reset all attributes to their defaults. total glow-down β¨1β set bold. make it thicc πͺ2β set half-bright (simulated with color on a color display). lowkey dim, they use color to fake it π¨3β set italic (since Linux 2.6.22; simulated with color on a color display). slanty vibes, also faked with color π¦4β set underscore (simulated with color on a color display). (the colors used to simulate dim or underline are set usingESC ] ...) underline but make it colorful π5β set blink. flashing like a warning β οΈ7β set reverse video. invert the colors, main character energy π10β reset selected mapping, display control flag, and toggle meta flag (ECMA-48 says "primary font"). it's giving font reset π11β select null mapping, set display control flag, reset toggle meta flag (ECMA-48 says "first alternate font"). alternate font, but null mapping? ok π12β select null mapping, set display control flag, set toggle meta flag (ECMA-48 says "second alternate font"). The toggle meta flag causes the high bit of a byte to be toggled before the mapping table translation is done. toggling bits, no cap π§21β set underline; before Linux 4.17, this value set normal intensity (as is done in many other terminals). underline, but old Linux did normal intensity instead π22β set normal intensity. back to normal, not too bright, not too dim π23β italic off (since Linux 2.6.22). no more slanty π«24β underline off. no more underlines π«25β blink off. stop the flashing π27β reverse video off. un-reverse, back to normal π30β set black foreground. text goes black π€31β set red foreground. red text alert π¨32β set green foreground. green text, like a terminal hacker π33β set brown foreground. brown text? ok vintage π€34β set blue foreground. blue text, calm vibes π35β set magenta foreground. magenta pop π36β set cyan foreground. cyan, very cyberpunk β¨37β set white foreground. white text, clean ποΈ38β 256/24-bit foreground color follows, shoehorned into 16 basic colors (before Linux 3.16: set underscore on, set default foreground color). fancy colors, but old Linux did something else π¨39β set default foreground color (before Linux 3.16: set underscore off, set default foreground color). back to default text color π―40β set black background. black bg π€41β set red background. red bg π¨42β set green background. green bg π43β set brown background. brown bg π€44β set blue background. blue bg π45β set magenta background. magenta bg π46β set cyan background. cyan bg β¨47β set white background. white bg ποΈ48β 256/24-bit background color follows, shoehorned into 8 basic colors. fancy bg colors, but only 8 basics π¨49β set default background color. back to default bg π―90..97β set foreground to bright versions of30..37. bright mode on π100..107β set background, same as40..47(bright not supported). bright bg? nope, just same as normal π
Commands 38 and 48 require further arguments:
;5;xβ 256 color: values0..15are IBGR (black, red, green, ..., white),16..231a 6x6x6 color cube,232..255a grayscale ramp. all the colors π;2;r;g;bβ 24-bit color,r/g/bcomponents are in the range0..255. true color, slay π¨
β¨ ECMA-48 Mode Switches β¨
ESC [ 3 hβ DECCRM (default off): Display control chars. πESC [ 4 hβ DECIM (default off): Set insert mode. like insert key on your keyboard β¨οΈESC [ 20 hβ LF/NL (default off): Automatically follow echo of LF, VT, or FF with CR. auto newline, fancy π
β¨ ECMA-48 Status Report Commands β¨
ESC [ 5 nβ Device status report (DSR): Answer isESC [ 0 n(Terminal OK). terminal says "I'm good" βESC [ 6 nβ Cursor position report (CPR): Answer isESC [ y ; x R, wherex,yis the cursor location. where's the cursor? here! π
β¨ DEC Private Mode (DECSET/DECRST) sequences β¨
These are not described in ECMA-48. We list the Set Mode sequences; the Reset Mode sequences are obtained by replacing the final'h'by'l'.
ESC [ ? 1 hβ DECCKM (default off): When set, the cursor keys send anESC Oprefix, rather thanESC [. cursor keys change their vibe β¬οΈESC [ ? 3 hβ DECCOLM (default off = 80 columns): 80/132 col mode switch. The driver sources note that this alone does not suffice; some user-mode utility such asresizecons(8)has to change the hardware registers on the console video card. 80 or 132 columns, but need extra help π₯οΈESC [ ? 5 hβ DECSCNM (default off): Set reverse-video mode. reverse video, but for the whole screen ποΈESC [ ? 6 hβ DECOM (default off): When set, cursor addressing is relative to the upper left corner of the scrolling region. origin mode, cursor goes relative πESC [ ? 7 hβ DECAWM (default on): Set autowrap on. In this mode, a graphic character emitted after column 80 (or column 132 if DECCOLM is on) forces a wrap to the beginning of the following line first. autowrap, so text doesn't run off πESC [ ? 8 hβ DECARM (default on): Set keyboard autorepeat on. hold key, it repeats πESC [ ? 9 hβ X10 Mouse Reporting (default off): Set reporting mode to 1 (or reset to 0) βsee belowβ. mouse reporting mode 1 π±οΈESC [ ? 25 hβ DECTECM (default on): Make cursor visible. show that cursor πESC [ ? 1000 hβ X11 Mouse Reporting (default off): Set reporting mode to 2 (or reset to 0) βsee belowβ. mouse reporting mode 2 π±οΈ
β¨ Linux Console Private CSI Sequences β¨
The following sequences are neither ECMA-48 nor native VT102. They are native to the Linux console driver. Colors are in SGR parameters:0= black,1= red,2= green,3= brown,4= blue,5= magenta,6= cyan,7= white;8β15= bright versions of0β7.
ESC [ 1 ; n ]β Set colornas the underline color. underline color picker ποΈESC [ 2 ; n ]β Set colornas the dim color. dim color picker πESC [ 8 ]β Make the current color pair the default attributes. save this color combo as default πΎESC [ 9 ; n ]β Set screen blank timeout tonminutes. screen saver timeout β²οΈESC [ 10 ; n ]β Set bell frequency in Hz. bell goes beep at this pitch πESC [ 11 ; n ]β Set bell duration in msec. bell beep length β±οΈESC [ 12 ; n ]β Bring specified console to the front. switch to consolenπ₯οΈESC [ 13 ]β Unblank the screen. wake up screen! βοΈESC [ 14 ; n ]β Set the VESA powerdown interval in minutes. power save timeout πESC [ 15 ]β Bring the previous console to the front (since Linux 2.6.0). go back to previous console βͺESC [ 16 ; n ]β Set the cursor blink interval in milliseconds (since Linux 4.2). cursor blink speed π°οΈ
β¨ Character sets β¨
The kernel knows about 4 translations of bytes into console-screen symbols. The four tables are: a) Latin1 -> PC, b) VT100 graphics -> PC, c) PC -> PC, d) user-defined.
There are two character sets, called G0 and G1, and one of them is the current character set. (Initially G0.) Typing ^N causes G1 to become current, ^O causes G0 to become current.
These variables G0 and G1 point at a translation table, and can be changed by the user. Initially they point at tables a) and b), respectively. The sequences ESC ( B and ESC ( 0 and ESC ( U and ESC ( K cause G0 to point at translation table a), b), c), and d), respectively. The sequences ESC ) B and ESC ) 0 and ESC ) U and ESC ) K cause G1 to point at translation table a), b), c), and d), respectively.
The sequence <rainbow>ESC c</rainbow> causes a terminal reset, which is what you want if the screen is all garbled. The oft-advised "echo ^V^O" will make only G0 current, but there is no guarantee that G0 points at table a). In some distributions there is a program reset(1) that just does "echo ^[c". If your terminfo entry for the console is correct (and has an entry rs1=\Ec), then "tput reset" will also work.
The user-defined mapping table can be set using mapscrn(8). The result of the mapping is that if a symbol c is printed, the symbol s = map[c] is sent to the video memory. The bitmap that corresponds to s is found in the character ROM, and can be changed using setfont(8).
β¨ Mouse tracking β¨
The mouse tracking facility is intended to return xterm(1)-compatible mouse status reports. Because the console driver has no way to know the device or type of the mouse, these reports are returned in the console input stream only when the virtual terminal driver receives a mouse update ioctl. These ioctls must be generated by a mouse-aware user-mode application such as the gpm(8) daemon.
The mouse tracking escape sequences generated by xterm(1) encode numeric parameters in a single character as value+040. For example, '!' is 1. The screen coordinate system is 1-based.
The X10 compatibility mode sends an escape sequence on button press encoding the location and the mouse button pressed. It is enabled by sending ESC [ ? 9 h and disabled with ESC [ ? 9 l. On button press, xterm(1) sends ESC [ M bxy (6 characters). Here b is button-1, and x and y are the x and y coordinates of the mouse when the button was pressed. This is the same code the kernel also produces.
Normal tracking mode (not implemented in Linux 2.0.24) sends an escape sequence on both button press and release. Modifier information is also sent. It is enabled by sending ESC [ ? 1000 h and disabled with ESC [ ? 1000 l. On button press or release, xterm(1) sends ESC [ M bxy. The low two bits of b encode button information: 0=MB1 pressed, 1=MB2 pressed, 2=MB3 pressed, 3=release. The upper bits encode what modifiers were down when the button was pressed and are added together: 4=Shift, 8=Meta, 16=Control. Again x and y are the x and y coordinates of the mouse event. The upper left corner is (1,1).
β¨ Comparisons with other terminals β¨
Many different terminal types are described, like the Linux console, as being "VT100-compatible". Here we discuss differences between the Linux console and the two most important others, the DEC VT102 and xterm(1).
β¨ Control-character handling β¨
The VT102 also recognized the following control characters:
NUL (0x00)β was ignored; nothing to see here πENQ (0x05)β triggered an answerback message; it would send a message back π¨DC1 (0x11, ^Q, XON)β resumed transmission; resume the flow βΆοΈDC3 (0x13, ^S, XOFF)β caused VT100 to ignore (and stop transmitting) all codes exceptXOFFandXON. pause everything except XOFF/XON βΈοΈ
VT100-like DC1/DC3 processing may be enabled by the terminal driver.
The xterm(1) program (in VT100 mode) recognizes the control characters BEL, BS, HT, LF, VT, FF, CR, SO, SI, ESC.
β¨ Escape sequences β¨
VT100 console sequences not implemented on the Linux console:
ESC Nβ SS2 Single shift 2. (Select G2 character set for the next character only.) one-character shift to G2 πESC Oβ SS3 Single shift 3. (Select G3 character set for the next character only.) one-character shift to G3 πESC Pβ DCS Device control string (ended byESC \). device control string ποΈESC Xβ SOS Start of string. start of string πESC ^β PM Privacy message (ended byESC \). privacy message π€«ESC \β ST String terminator. string terminator πESC * ...β Designate G2 character set. set G2 charset π¨ESC + ...β Designate G3 character set. set G3 charset π¨
The program xterm(1) (in VT100 mode) recognizes ESC c, ESC # 8, ESC >, ESC =, ESC D, ESC E, ESC H, ESC M, ESC N, ESC O, ESC P ... ESC \, ESC Z (it answers ESC [ ? 1 ; 2 c, "I am a VT100 with advanced video option") and ESC ^ ... ESC \ with the same meanings as indicated above. It accepts ESC (, ESC ), ESC *, ESC + followed by 0, A, B for the DEC special character and line drawing set, UK, and US-ASCII, respectively.
The user can configure xterm(1) to respond to VT220-specific control sequences, and it will identify itself as a VT52, VT100, and up depending on the way it is configured and initialized.
It accepts ESC ] (OSC) for the setting of certain resources. And periodt, besides the ECMA-48 string terminator (ST), xterm(1) is also chill with a BEL to terminate an OSC string. So here are a few of the OSC control sequences that xterm(1) recognizes, bestie β lowkey iconic that there are this many:
ESC ] 0 ; txt STβ sets the icon name and the window title to txt.ESC ] 1 ; txt STβ sets the icon name to txt only.ESC ] 2 ; txt STβ sets the window title to txt only.ESC ] 4 ; num ; txt STβ sets color number num (that's0-255, no cap) to txt.ESC ] 5 ; 0 ; txt STβ sets the color used for bold substitution to txt.ESC ] 5 ; 1 ; txt STβ sets the color used for underline substitution to txt.ESC ] 5 ; 2 ; txt STβ sets the color used for blinking substitution to txt.ESC ] 5 ; 3 ; txt STβ sets the color used for reverse substitution to txt.ESC ] 5 ; 4 ; txt STβ sets the color used for italic substitution to txt.ESC ] 6 ; 0 ; val STβ toggles bold rendition:0=bold,1=substitute by color.ESC ] 6 ; 1 ; val STβ toggles underscore rendition:0=underscore,1=color.ESC ] 6 ; 2 ; val STβ toggles blinking rendition:0=blinking,1=color.ESC ] 6 ; 3 ; val STβ toggles reverse rendition:0=reverse,1=color.ESC ] 6 ; 4 ; val STβ toggles italic rendition:0=italic,1=color.ESC ] 10 ; txt STβ sets the foreground text color to txt.ESC ] 11 ; txt STβ sets the background color to txt.ESC ] 12 ; txt STβ sets the text cursor color to txt.ESC ] 13 ; txt STβ sets the mouse cursor foreground color to txt.ESC ] 14 ; txt STβ sets the mouse cursor background color to txt.ESC ] 15 ; txt STβ sets the Tektronix foreground color to txt.ESC ] 16 ; txt STβ sets the Tektronix background color to txt.ESC ] 17 ; txt STβ sets the background text color for highlighted (a.k.a. selected) text to txt.ESC ] 18 ; txt STβ sets the Tektronix cursor color to txt.ESC ] 19 ; txt STβ sets the foreground text color for highlighted (a.k.a. selected) text to txt.ESC ] 46 ; name STβ changes the log file to name (normally disabled by a compile-time option, so don't be shocked if it ghosts you).ESC ] 50 ; fn STβ sets the font to fn (this escape code is normally disabled; check "allowFontOps" inxterm(1)).ESC ] 104 ; num STβ resets color for mode4;numESC ] 105 ; num STβ resets color for mode5;numESC ] 106 ; num ; val STβ exactly equal to6;num;val. (there's no "reset" logic here, so set your expectations accordingly)ESC ] 110 STβ resets color for mode 10. Codes111-119map to resetting modes 11-19, respectively. Slay, sequential.ESC ] mode ; ? STβ queries the respective property/color/etc. (modes4,5,10-19,50)
It also recognizes the following, with slightly modified meaning β it's saving more state and behaving closer to VT100/VT220, so it's giving overachiever:
ESC 7DECSCβ save cursorESC 8DECRCβ restore cursor
It also recognizes:
ESC Fβ cursor to the lower left corner of the screen (only if enabled byxterm(1)'shpLowerleftBugCompatresource).ESC lβ memory lock (per HP terminals). Locks memory above the cursor.ESC mβ memory unlock (per HP terminals).ESC nLS2β invoke the G2 character set.ESC oLS3β invoke the G3 character set.ESC |LS3Rβ invoke the G3 character set as GR.ESC }LS2Rβ invoke the G2 character set as GR.ESC ~LS1Rβ invoke the G1 character set as GR.
It also recognizes ESC % and provides a more complete UTF-8 implementation than the Linux console does. We love a glow-up. π
π CSI Sequences π
Old versions of xterm(1) β like, imagine, from X11R5 β interpret the blink SGR as a bold SGR. Later versions that implemented ANSI colors (for example XFree86 3.1.2A in 1995) improved this by letting the blink attribute be displayed as a color. Modern versions of xterm(1) implement blink SGR as actual blinking text, and they still allow colored text as an alternate rendering of SGRs. Stock X11R6 versions did not recognize the color-setting SGRs until the X11R6.8 release, which incorporated XFree86 xterm(1). All ECMA-48 CSI sequences recognized by Linux are also recognized by xterm(1) β however, xterm(1) implements several ECMA-48 and DEC control sequences that Linux does not recognize. Not me pointing out that the vibes are asymmetric π
The xterm(1) program recognizes all of the DEC Private Mode sequences listed above, but exactly none of the Linux private-mode sequences. For discussion of xterm(1)'s own private-mode sequences, go read the Xterm Control Sequences document by Edward Moy, Stephen Gildea, and Thomas E. Dickey, available with the X distribution. That document, though terse, is much longer than this manual page. For a chronological overview,
http://invisible-island.net/xterm/xterm.log.html
details changes to xterm(1). Bookmark it fr fr.
The vttest(1) program
http://invisible-island.net/vttest/
demonstrates many of these control sequences. And the xterm(1) source distribution also contains sample scripts which exercise other features. Very much "come get your demo content." β¨
π NOTES π
ESC 8 (DECRC) is not able to restore the character set that was changed with ESC %. So it's giving partial memory only, beware.
π BUGS π
In Linux 2.0.23, CSI is broken, and NUL is not ignored inside escape sequences. Yikes.
Some older kernel versions (after Linux 2.0) interpret 8-bit control sequences. These "C1 controls" use codes between 128 and 159 to replace ESC [, ESC ] and similar two-byte control sequence initiators. There are fragments of that in modern kernels (either overlooked or broken by changes to support UTF-8), but the implementation is incomplete and should be regarded as unreliable. So, unreliable = do not trust it, bestie.
Linux "private mode" sequences do not follow the rules in ECMA-48 for private mode control sequences. In particular, those ending with ] do not use a standard terminating character. The OSC (set palette) sequence is an even bigger problem, since xterm(1) may interpret this as a control sequence which requires a string terminator (ST). Unlike the setterm(1) sequences, which will be ignored (since they are invalid control sequences), the palette sequence will make xterm(1) appear to hang β though pressing the return-key will fix that. To accommodate applications which have been hardcoded to use Linux control sequences, set the xterm(1) resource brokenLinuxOSC to true. π
An older version of this document implied that Linux recognizes the ECMA-48 control sequence for invisible text. It is ignored. Periodt.
π¦ SEE ALSO π¦
Ok that's the whole thing, you made it to the end, icon behavior honestly π This page is from Linux man-pages 6.20, dated 2026-07-29, and that's the tea β now go forth and make your terminal do cute things ππΈ
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: GPL-2.0-or-later
- Copyright 1996, Andries E. Brouwer <aeb@cwi.nl>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms