^[control-codes live in libghostty-vt

Control sequences by final byte

A control sequence is CSI, then its parameters, then the byte that says which function it is: CSI 3 E is CNL because it ends in E. That last byte, the final byte, is one of @ to ~, 40 to 7E in hexadecimal. Before it may come a private marker, one of < = > ? straight after CSI, and intermediate bytes, SP and ! " # $ % & ' ( ) * + , - . /, and with those the same final byte names a different function: CSI Ps J is ED, CSI ? Ps J is DECSED, and CSI Ps SP q is DECSCUSR. So to look a sequence up, find its final byte below, then the row with the same marker and intermediates.

The table holds every function with a page on this site, the replies and companions those pages cover, and the ECMA-48 functions that terminals do not use, which lead to the rest of ECMA-48. The modes are left out: each is SM or RM, h or l, with an ANSI mode’s number, or DECSET or DECRST with a private mode’s.

By final byte

FinalHexSequenceMnemonicName
@40CSI Pn @ICHInsert Character
@40CSI Pn SP @SLScroll Left
A41CSI Pn ACUUCursor Up
A41CSI Pn SP ASRScroll Right
B42CSI Pn BCUDCursor Down
B42CSI Pn1 ; Pn2 SP BGSMGraphic Size Modification
C43CSI Pn CCUFCursor Forward
C43CSI Pn SP CGSSGraphic Size Selection
D44CSI Pn DCUBCursor Backward
D44CSI Ps1 ; Ps2 SP DFNTFont Selection
E45CSI Pn ECNLCursor Next Line
E45CSI Pn SP ETSSThin Space Specification
F46CSI Pn FCPLCursor Preceding Line
F46CSI Ps … SP FJFYJustify
G47CSI Pn GCHACursor Character Absolute
G47CSI Pn1 ; Pn2 SP GSPISpacing Increment
H48CSI Pl ; Pc HCUPCursor Position
H48CSI Ps … SP HQUADQuad
I49CSI Pn ICHTCursor Horizontal Tabulation
I49CSI Ps SP ISSUSelect Size Unit
J4ACSI Ps JEDErase in Display
J4ACSI Ps SP JPFSPage Format Selection
J4ACSI ? Ps JDECSEDSelective Erase in Display
K4BCSI Ps KELErase in Line
K4BCSI Ps SP KSHSSelect Character Spacing
K4BCSI ? Ps KDECSELSelective Erase in Line
L4CCSI Pn LILInsert Line
L4CCSI Ps SP LSVSSelect Line Spacing
M4DCSI Pn MDLDelete Line
M4DCSI Ps SP MIGSIdentify Graphic Subrepertoire
N4ECSI Ps NEFErase In Field
O4FCSI Ps OEAErase In Area
O4FCSI Ps SP OIDCSIdentify Device Control String
P50CSI Pn PDCHDelete Character
P50CSI Pn SP PPPAPage Position Absolute
Q51CSI Ps QSEESelect Editing Extent
Q51CSI Pn SP QPPRPage Position Forward
R52CSI Pl ; Pc RCPRActive Position Report
R52CSI Pn SP RPPBPage Position Backward
R52CSI ? Pl ; Pc ; Pp RDECXCPRExtended Cursor Position Report
S53CSI Pn SSUScroll Up
S53CSI Ps1 ; Ps2 SP SSPDSelect Presentation Directions
T54CSI Pn TSDScroll Down
T54CSI Pn1 ; Pn2 SP TDTADimension Text Area
U55CSI Pn UNPNext Page
U55CSI Pn SP USLHSet Line Home
V56CSI Pn VPPPreceding Page
V56CSI Pn SP VSLLSet Line Limit
W57CSI Pm WCTCCursor Tabulation Control
W57CSI Pn SP WFNKFunction Key
W57CSI ? 5 WDECST8CSet Tab at Every 8 Columns
X58CSI Pn XECHErase Character
X58CSI Ps SP XSPQRSelect Print Quality And Rapidity
Y59CSI Pn YCVTCursor Line Tabulation
Y59CSI Ps1 ; Ps2 SP YSEFSheet Eject And Feed
Z5ACSI Pn ZCBTCursor Backward Tabulation
Z5ACSI Ps SP ZPECPresentation Expand Or Contract
[5BCSI Ps [SRSStart Reversed String
[5BCSI Pn SP [SSWSet Space Width
\5CCSI Ps \PTXParallel Texts
\5CCSI Pn SP \SACSSet Additional Character Separation
]5DCSI Ps ]SDSStart Directed String
]5DCSI Ps … SP ]SAPVSelect Alternative Presentation Variants
^5ECSI Ps ^SIMDSelect Implicit Movement Direction
^5ECSI Ps SP ^STABSelective Tabulation
_5FCSI Ps SP _GCCGraphic Character Combination
`60CSI Pn `HPACharacter Position Absolute
`60CSI Pn SP `TATETabulation Aligned Trailing Edge
a61CSI Pn aHPRCharacter Position Forward
a61CSI Pn SP aTALETabulation Aligned Leading Edge
b62CSI Pn bREPRepeat
b62CSI Pn SP bTACTabulation Aligned Centred
c63CSI Ps cDADevice Attributes
c63CSI Pn1 ; Pn2 SP cTCCTabulation Centred On Character
d64CSI Pn dVPALine Position Absolute
d64CSI Pn SP dTSRTabulation Stop Remove
e65CSI Pn eVPRLine Position Forward
e65CSI Ps SP eSCOSelect Character Orientation
f66CSI Pl ; Pc fHVPHorizontal and Vertical Position
f66CSI Pn SP fSRCSSet Reduced Character Separation
g67CSI Ps gTBCTabulation Clear
g67CSI Pn SP gSCSSet Character Spacing
h68CSI Pm hSMSet Mode
h68CSI Pn SP hSLSSet Line Spacing
h68CSI ? Pm hDECSETDEC Private Mode Set
i69CSI Ps iMCMedia Copy
i69CSI Pn SP iSPHSet Page Home
j6ACSI Pn jHPBCharacter Position Backward
j6ACSI Pn SP jSPLSet Page Limit
k6BCSI Pn kVPBLine Position Backward
k6BCSI Ps1 ; Ps2 SP kSCPSelect Character Path
l6CCSI Pm lRMReset Mode
l6CCSI ? Pm lDECRSTDEC Private Mode Reset
m6DCSI Pm mSGRSelect Graphic Rendition
m6DCSI > Pp ; Pv mXTMODKEYSSet Key Modifier Options
n6ECSI Ps nDSRDevice Status Report
n6ECSI ? Ps nDECDSRDEC Device Status Reports
o6FCSI Ps … oDAQDefine Area Qualification
p70CSI ! pDECSTRSoft Terminal Reset
p70CSI Pl ; Pc " pDECSCLSelect Conformance Level
p70CSI Pa $ pDECRQMRequest Mode, for an ANSI mode
p70CSI Pr + pDECSRSecure Reset
p70CSI ? Pd $ pDECRQMRequest Mode
q71CSI Ps SP qDECSCUSRSet Cursor Style
q71CSI Ps " qDECSCASelect Character Protection Attribute
q71CSI Pr * qDECSRCSecure Reset Confirmation
q71CSI > Ps qXTVERSIONReport Version
r72CSI Pt ; Pb rDECSTBMSet Top and Bottom Margins
r72CSI Pt ; Pl ; Pb ; Pr ; Pm $ rDECCARAChange Attributes in Rectangular Area
r72CSI ? Pm rXTRESTORERestore DEC Private Mode Values
s73CSI Pl ; Pr sDECSLRMSet Left and Right Margins
s73CSI ? Pm sXTSAVESave DEC Private Mode Values
t74CSI Ps ; Ps ; Ps tXTWINOPSWindow Operations
t74CSI Pt ; Pl ; Pb ; Pr ; Pm $ tDECRARAReverse Attributes Rectangular Area
u75CSI Ps $ uDECRQTSRRequest Terminal State Report
u75CSI & uDECRQUPSSRequest User-Preference Supplemental Set
u75CSI < Pn uCSI < uPop Flags
u75CSI = Ps ; Pm uCSI = uKitty Keyboard Protocol
u75CSI > Ps uCSI > uPush Flags
u75CSI ? Ps uCSI ? uReport Flags
u75CSI ? uCSI ? uQuery Flags
v76CSI Pm $ vDECCRACopy Rectangular Area
w77CSI Ps $ wDECRQPSRRequest Presentation State Report
w77CSI Pt ; Pl ; Pb ; Pr ' wDECEFREnable Filter Rectangle
x78CSI Pch ; Pt ; Pl ; Pb ; Pr $ xDECFRAFill Rectangular Area
x78CSI Ps * xDECSACESelect Attribute Change Extent
y79CSI 4 ; Ps … yDECTSTInvoke Confidence Test
y79CSI Ps # yXTCHECKSUMSelect Checksum Extension
y79CSI Pa ; Ps $ yDECRPMReport Mode, for an ANSI mode
y79CSI Pi ; Pp ; Pt ; Pl ; Pb ; Pr * yDECRQCRARequest Checksum of Rectangular Area
y79CSI ? Pd ; Ps $ yDECRPMReport Mode, for a private mode
z7ACSI Pt ; Pl ; Pb ; Pr $ zDECERAErase Rectangular Area
z7ACSI Ps ; Pu ' zDECELREnable Locator Reports
{7BCSI Pt ; Pl ; Pb ; Pr $ {DECSERASelective Erase Rectangular Area
{7BCSI Pm ' {DECSLESelect Locator Events
{7BCSI Pn * {DECMSRMacro Space Report
|7CCSI Pn $ |DECSCPPSet Columns Per Page
|7CCSI Ps ' |DECRQLPRequest Locator Position
|7CCSI Pn * |DECSNLSSelect Number of Lines per Screen
}7DCSI Ps $ }DECSASDSelect Active Status Display
}7DCSI Pn ' }DECICInsert Column
~7ECSI Ps $ ~DECSSDTSelect Status Display Type
~7ECSI Pn ' ~DECDCDelete Column
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.