Terminal Emulator Control Sequences
Terminal Control Sequences
Sequence Description
<ESC>c Reset display to initial state
<ESC>8 Display alignment test
Cursor Control Sequences
Sequence Description
<ESC>D Move cursor down to next line
<ESC>E Move cursor to first column and down one line
<ESC>M Move cursor up one line
<ESC>7 Save cursor position, attributes and colors
<ESC>8 Restore saved cursor position, attributes and colors
<ESC>[nA Move cursor up n lines
<ESC>[nB Move cursor down n lines
<ESC>[nC Move cursor forward n spaces
<ESC>[nD Move cursor backward n spaces
<ESC>[nE Move cursor to beginning of line, down n lines
<ESC>[nF Move cursor to beginning of line, up n lines
<ESC>[xG Move cursor to column x
<ESC>[y;xH Move cursor to line y, column x
<ESC>[nI Move cursor forward n tabstops
<ESC>[nZ Move cursor backwards n tabstops
<ESC>[na Move cursor forward n spaces
<ESC>[yd Move cursor to row y
<ESC>[ne Move cursor down n lines
<ESC>[y;xf Move cursor to line y, column x
<ESC>[s Save cursor position
<ESC>[u Return to saved cursor position
<ESC>[x` Move cursor to column x
Attribute and Color Sequence
Sequence Description
<ESC>[nm Select display attributes and color
n Value
Description
0 Reset to default attributes and colors
1 Bold attribute
2 Dim attribute
4 Underline attribute
5 Blink attribute (same as reverse)
7 Reverse attribute
8 Hidden attribute
22 Clear bold attribute
24 Clear underline attribute
25 Clear blink attribute
27 Clear reverse attribute
29 Clear color attributes
30 Black foreground
31 Red foreground
32 Green foreground
33 Yellow foreground
34 Blue foreground
35 Magenta foreground
36 Cyan foreground
37 White foreground
40 Black background
41 Red background
42 Green background
43 Yellow background
44 Blue background
45 Magenta background
46 Cyan background
47 White background
Character Set Sequences
Sequence Description
<ESC>(A Assign ISO Latin 1 character set to font bank G0
<ESC>(B Assign United States ASCII character set to font bank G0
<ESC>(0 Assign graphics character set to font bank G0
<ESC>)A Assign ISO Latin 1 character set to font bank G1
<ESC>)B Assign United States ASCII character set to font bank G1
<ESC>)0 Assign graphics character set to font bank G1
Erase Sequences
Sequence Description
<ESC>[n@ Insert n blank spaces
<ESC>[nJ Erase all or part of the display
n Value
Description
0 From current position to end of display
1 From beginning of display to current position
2 Erase the entire display
<ESC>[nK Erase all or part of a line
n Value
Description
0 From current position to end of line
1 From beginning of line to current position
2 Erase the entire line
<ESC>[nL Insert n new blank lines
<ESC>[nM Delete n lines from current cursor position
<ESC>[nP Delete n characters from current cursor position
Scrolling Sequences
Sequence Description
<ESC>[nS Scroll display up n lines
<ESC>[nT Scroll display down n lines
<ESC>[nX Erase n characters from the current position
<ESC>[y1;y2r Set scrolling region from lines y1 to y2
Keypad Sequences
Sequence Description
<ESC>= Place keypad into applications mode
<ESC>> Place keypad into numeric mode
Emulation Option Sequences
Sequence Description
<ESC>[?nh Set emulation option
n Value
Description
1 Enable cursor key application mode
2 Enable ANSI escape sequences
5 Reverse display foreground and background colors
6 Enable origin mode
7 Enable auto-wrap mode
20 Enable linefeed/newline mode
25 Display caret
66 Place keypad in applications mode
<ESC>[?n1 Set emulation option
n Value
Description
1 Disable cursor key application mode
2 Enable VT52 escape sequences
5 Restore display foreground and background colors
6 Disable origin mode
7 Disable auto-wrap mode
20 Disable linefeed/newline mode
25 Hide caret
66 Place keypad in numeric mode
Console Escape Sequences
Sequence Description
<ESC>[=nA Set the overscan color (ignored)
<ESC>[=n1;n2B Set bell sound (parameters ignored)
<ESC>[=n1;n2C Set the caret size
<ESC>[=nD Set background color intensity
n Value
Description
0 Decrease background color intensity
1 Increase background color intensity
<ESC>[=nE Set blink vs. bold attribute (ignored)
<ESC>[=nF Set normal foreground color
<ESC>[=nG Set normal background color
<ESC>[=nH Set reverse foreground color
<ESC>[=nI Set reverse background color
<ESC>[=nJ Set graphics foreground color
<ESC>[=nK Set graphics background color
n Value
Description
0 Black
1 Blue
2 Green
3 Cyan
4 Red
5 Magenta
6 Brown
7 White
8 Gray
9 Light blue
10 Light green
11 Light cyan
12 Light red
13 Light magenta
14 Yellow
15 High White
Control Character Sequences
Sequence Description
<CTL>G Ring audible bell, if enabled
<CTL>H Move cursor one character backwards
<CTL>I Move cursor forward to next tabstop
<CTL>J Move cursor down to next line
<CTL>M Move cursor to beginning of line
<CTL>N Select G1 character set
<CTL>O Select G0 character set
<CTL>Z Abort current escape sequence
<DEL> Erase and move cursor one character backwards
ANSI Function Key Sequences
Sequence Description
<ESC>[M Function Key 1
<ESC>[N Function Key 2
<ESC>[O Function Key 3
<ESC>[P Function Key 4
<ESC>[Q Function Key 5
<ESC>[R Function Key 6
<ESC>[S Function Key 7
<ESC>[T Function Key 8
<ESC>[U Function Key 9
<ESC>[V Function Key 10
<ESC>[W Function Key 11
<ESC>[X Function Key 12
VT100 Function Key Sequences
Sequence Description
<ESC>OP Function Key 1 (PF1)
<ESC>OQ Function Key 2 (PF2)
<ESC>OR Function Key 3 (PF3)
<ESC>OS Function Key 4 (PF4)


A VT100 terminal only has four programmable function keys. All other function keys are
undefined, however some applications map the remaining keys using the sequences
for a VT220 terminal.

VT220 Function Key Sequences
Sequence Description
<ESC>OP Function Key 1 (PF1)
<ESC>OQ Function Key 2 (PF2)
<ESC>OR Function Key 3 (PF3)
<ESC>OS Function Key 4 (PF4)
<ESC>[17~ Function Key 6
<ESC>[18~ Function Key 7
<ESC>[19~ Function Key 8
<ESC>[20~ Function Key 9
<ESC>[21~ Function Key 10
<ESC>[22~ Function Key 11
<ESC>[23~ Function Key 12


The first five function keys in the top row on a VT220 are designed for local functions and
are usually not configured so that an application can detect them. In the emulator, F1-F4
are mapped the same as the PF1-PF4 keys on a VT100. The F5 key is left undefined
because there is no direct mapping for this key on a VT220 keyboard. Some applications
may require that the keys be remapped to an alternate sequence.

VT220 Function Key Sequences (Alternate)
Sequence Description
<ESC>[11~ Function Key 1
<ESC>[12~ Function Key 2
<ESC>[13~ Function Key 3
<ESC>[14~ Function Key 4
<ESC>[15~ Function Key 5
<ESC>[17~ Function Key 6
<ESC>[18~ Function Key 7
<ESC>[19~ Function Key 8
<ESC>[20~ Function Key 9
<ESC>[21~ Function Key 10
<ESC>[22~ Function Key 11
<ESC>[23~ Function Key 12

 


Copyright © 2008 Catalyst Development Corporation. All rights reserved.