VT100 terminal control codes

Code Meaning
<ESC>[0m Reset all color and text attributes
<ESC>[1m Bright/bold color
<ESC>[2m Dim/unbold color
<ESC>[4m Underline text
<ESC>[5m Blinking text
<ESC>[7m Reversed color text (foreground and background colors are swapped)
<ESC>[8m Hidden Text (characters not displayed)
<ESC>[30m Black foreground
<ESC>[31m Red foreground
<ESC>[32m Green foreground
<ESC>[33m Yellow foreground
<ESC>[34m Blue foreground
<ESC>[35m Magenta foreground
<ESC>[36m Cyan foreground
<ESC>[37m White foreground
<ESC>[40m Black background
<ESC>[41m Red background
<ESC>[42m Green background
<ESC>[43m Yellow background
<ESC>[44m Blue background
<ESC>[45m Magenta background
<ESC>[46m Cyan background
<ESC>[47m White background
<ESC>[<R>;<C>H Move cursor to row <R> and column <C>, or to the "HOME" position if both <R> and <C> are omitted.
<ESC><C>A Move cursor up <C>, or one line if <C> is omitted.
<ESC><C>B Move cursor down <C>, or one line if <C> is omitted.
<ESC><C>C Move cursor forward <C>, or one space if <C> is omitted.
<ESC>[K Erase everything after the cursor on the current line.
<ESC>[1K Erase everything before the cursor on the current line.
<ESC>[2K Erase the current line.
<ESC>[J Erase every line below the current line.
<ESC>[1J Erase every line above the current line.
<ESC>[2J Erase entire screen.
 
from http://ascii-table.com/ansi-escape-esquences-vt-100.php
<ESC>[20h Set new line mode
<ESC>[?1h Set cursor key to application
none Set ANSI (versus VT52)
<ESC>[?3h Set number of columns to 132
<ESC>[4h Set smooth scrolling
<ESC>[5h Set reverse video on screen
<ESC>[6h Set origin to relative
<ESC>[7h Set auto-wrap mode
<ESC>[8h Set auto-repeat mode
<ESC>[9h Set interlacing mode
 
<ESC>[20i Set line feed mode
<ESC>[?1i Set cursor key to cursor
<ESC>[?2i Set VT52 mode (versus ANSI)
<ESC>[?3i Set number of columns to 80
<ESC>[?4i Set jump scrolling
<ESC>[?5i Set normal video on screen
<ESC>[?6i Set origin to absolute
<ESC>[?7i Reset auto-wrap mode
<ESC>[?8i Reset auto-repeat mode
<ESC>[?9i Reset interlacing mode
 
<ESC> = Set alternate keypad mode
<ESC> > Set numberic keypad mode
 
<ESC>(A Set United Kingdom G0 character set
<ESC>)A Set United Kingdom G1 character set
<ESC>(B Set United States G0 character set
<ESC>)B Set United States G1 character set
<ESC>(0 Set G0 special characters and line set
<ESC>)0 Set G1 special characters and line set
<ESC>(1 Set G0 alternate character ROM
<ESC>)1 Set G1 alternate chacter ROM
<ESC>(2 Set G0 alt char ROM and spec. graphics
<ESC>)2 Set G1 alt char ROM and spec. graphics
 
<ESC>N Set single shift 2
<ESC>O Set single shift 3
<ESC>[m Turn off character attributes
<ESC>[0m Turn off character attributes
<ESC>[1m Turn bold mode on
<ESC>[2m Turn low intensity mode on
<ESC>[4m Turn underline mode on
<ESC>[5m Turn blinking mode on
<ESC>[7m Turn reverse video on
<ESC>[8m Turn invisible mode on
 
<ESC>[<line>;<line>r Set top and bottom lines of a window
<ESC>[<n>A Move cursor up n lines
<ESC>[<n>B Move cursor donw n lines
<ESC>[<n>C Move cursor right n liens
<ESC>[>n<D Move cursor left n lines
<ESC>[H Move cursor to upper left corner
<ESC>[;H Move cursor to upper left corner
<ESC>[<line>;<column>H Move cursor to screen location v,h
<ESC>[f Move cursor to upper left corner
<ESC>[;f Move cursor to upper left corner
<ESC>[<line>;<column>f Move cursor to scren location v,h
<ESC>D Move/scroll window up one line
<ESC>M Move/scroll window down one line
<ESC>E Move to next line
<ESC>7 Save cursor position and attributes
<ESC>8 Restore cursor position and attributes
 
<ESC>H Set a tab at the current column
<ESC>[g Clear a tab at the current column
<ESC>[0g Clear a tab at the current column
<ESC>[3g Clear all tabs
 
<ESC>#3 Double-height letters, top half
<ESC>#4 Double-height lettes, bottom half
<ESC>#5 Single width, single height letters
<ESC>#6 Double width, single height letters
 
<ESC>[K Clear line from cursor right
<ESC>[0K Clear line from cursor right
<ESC>[1K Clear line from cursor left
<ESC>[2K Clear entire line
 
<ESC>[J Clear screen from cursor down
<ESC>[0J Clear screen from cursor down
<ESC>[1J Clear screen from cursor up
<ESC>[2J Clear entire screen
 
<ESC>5n Device status report
<ESC>0n Response: terminal is OK
<ESC>3n Response: terminal is not OK
 
<ESC>6n Get cursor position
<ESC><line>;<column>R Response: cursor is at v,h
<ESC>[c Identify what terminal type
<ESC>[0c Identify what terminal type (another)
<ESC>[?1;<value>0c Response: terminal type code n
 
<ESC>c Reset terminal to initial state
 
<ESC>#8 Screen alignment display
<ESC>[2;1y Confidence power up test
<ESC>[2;2y Confidence loopback test
<ESC>[2;9y Repeat power up test
<ESC>[2;10y Repeat loopback test
 
<ESC>[0q Turn off all four LEDs
<ESC>[1q Turn on LED #1
<ESC>[2q Turn on LED #2
<ESC>[3q Turn on LED #3
<ESC>[4q Turn on LED #4
 
Codes for use in VT52 compatibility mode
<ESC> < Enter/Exit ANSI mode (VT52)
<ESC> = Enter alternate keypad mode
<ESC> > Exit alternate keypad mode
 
<ESC>F Use special graphics character set
<ESC>G Use normal US/UK character set
 
<ESC>A Move cursor up one line
<ESC>B Move cursor down one line
<ESC>C Move cursor right one line
<ESC>D Move cursor left one line
<ESC>H Move cursor to upper left corner
<ESC><line><column> Move cursor to v,h location
<ESC>I Generate a reverse line-feed
 
<ESC>K Erase to end of cursor line
<ESC>J Erase to end of screen
 
<ESC>Z Identify what the terminal is
<ESC>/Z Correct response to ident
 
VT100 Special Key Codes
<ESC>OP PF1
<ESC>OQ PF2
<ESC>OR PF3
<ESC>OS PF4
 
<ESC>A Reset up
<ESC>OA Set up
<ESC>B Reset down
<ESC>OB Set down
<ESC>C Reset right
<ESC>OC Set right
<ESC>D Reset left
<ESC>OD Set left
 
<ESC>Op Numeric keypad 0
<ESC>Oq Numeric keypad 1
<ESC>Or Numeric keypad 2
<ESC>Os Numeric keypad 3
<ESC>Ot Numeric keypad 4
<ESC>Ou Numeric keypad 5
<ESC>Ov Numeric keypad 6
<ESC>Ow Numeric keypad 7
<ESC>Ox Numeric keypad 8
<ESC>Oy Numeric keypad 9
<ESC>Om Numeric keypad minus
<ESC>Ol Numeric keypad comma
<ESC>On Numeric keypad period
<ESC>OM ^M
 
<ESC>[i Print the current screen
<ESC>[1i Print the current line
<ESC>[4i Disable log
<ESC>[5i start log; all received text is echoed to the printer

home

Wenton's email (wenton@ieee.org)