Terminal Escape Code Zen

Lightning Strikes Twice!

AskApache Conquers the 3rd Dimension in Bash


3rd Dimension Broken with Bash!

AskApache Conquers the 3rd Dimension in Bash

So 3D... it'll hurt you eyes! lol.. Man I am cracking up here. Ha but seriously those really do look 3D for terminal though.. I am actually really impressed. Sweet. Here is the little function I wrote to output that grey marble.

Just a word to the wise, start learning and going over some of these concepts, especially the code used in functions, I will be back in a followup that details actually using this stu.

This function is one of my favorites because it is so fast and useful. Like when designing a 256color prompt.

aa_256 ()
    local o x=`tput op` y=`printf %$((${COLUMNS}-6))s`;
    for i in {0..256};
        echo -e ${o:${#o}-3:3} `tputm "setaf $i" "setab $i"`${y// /=}$x;

Ya this is actually not very helpful or useful, but there you have it.

tputm ()
    local a;
    for a in "$@";
        echo -en "${a}n";
    done | tput -S

Some people call this function the grey bringer of death. Not really.

a256 ()
    ( x=`tput op` y=`printf %$((${COLUMNS}-6))slocal `;
    for i in {242..232} 232 232;
        echo -en "`tput setaf $i;tput setab $i`${y}${x}`tput op`";
    done )
Fix screen

Helpful Ncurses Programs

Program NameDescriptionExample Usage
infotocapconvert a terminfo description into a termcap description
ticthe terminfo entry-description compiler
toetable of (terminfo) entriestoe -a|sort -d
infocmpcompare or print out terminfo descriptionsinfocmp -a -L -1 -T -x
capconvertautomated conversion from termcap to terminfo
sttyprints or changes terminal characteristics, such as baud rate.
clearclears the terminal's screen
capconvertautomated conversion from termcap to terminfo

ALWAYS check out my functions!

This function will print out the terminal, show it's colors, etc.. I have some really nice ones in this article that I use for tmux, screen, and that sort of thing.

c ()
    tput clear;
    pm "$TERM: [colors:`tput colors`/`tput pairs`]";
    RC=`tput op` L1=$(L '=' $(( ${COLUMNS} - 25 )));
    for i in `seq ${1:-0} ${2:-16}`;
        o="  $i";
        echo -e " ${o:${#o}-3:3} `tput setaf $i;tput setab $i`${L1}${RC}";

Standard Capabilities

X.364 and iBCS2

  • \33c - RIS - full reset
  • \337 - SC - save cursor
  • \338 - RC - restore cursor
  • \33[r - RSR - not an X.364 mnemonic
  • \33[m - SGR0 - not an X.364 mnemonic
  • \33[2J - ED2 - clear page

Specified by ISO 2022

  • \33(0 - ISO DEC G0 - enable DEC graphics for G0
  • \33(A - ISO UK G0 - enable UK chars for G0
  • \33(B - ISO US G0 - enable US chars for G0
  • \33)0 - ISO DEC G1 - enable DEC graphics for G1
  • \33)A - ISO UK G1 - enable UK chars for G1
  • \33)B - ISO US G1 - enable US chars for G1

ISO 2022 charset switching:

DEC private controls widely supported by emulators

  • \33= - DECPAM - application keypad mode
  • \33> - DECPNM - normal keypad mode
  • \33< - DECANSI - enter ANSI mode
  • \33[!p - DECSTR - soft reset
  • \33 F - S7C1T - 7-bit controls

ECMA modes

ISO 2022

  • 2 - AM - keyboard action mode
  • 4 - IRM - insert/replace mode
  • 12 - SRM - send/receive mode
  • 20 - LNM - linefeed mode

DEC modes

  • 1 - CKM - application cursor keys
  • 2 - ANM - set VT52 mode
  • 3 - COLM - 132-column mode
  • 4 - SCLM - smooth scroll
  • 5 - SCNM - reverse video mode
  • 6 - OM - origin mode
  • 7 - AWM - wraparound mode
  • 8 - ARM - auto-repeat mode

ECMA attribute sequences

  • 0 - NORMAL - normal
  • 1 - +BOLD - bold on
  • 2 - +DIM - dim on
  • 3 - +ITALIC - italic on
  • 4 - +UNDERLINE - underline on
  • 5 - +BLINK - blink on
  • 6 - +FASTBLINK - fastblink on
  • 7 - +REVERSE - reverse on
  • 8 - +INVISIBLE - invisible on
  • 9 - +DELETED - deleted on
  • 10 - MAIN-FONT - select primary font
  • 11 - ALT-FONT-1 - select alternate font 1
  • 12 - ALT-FONT-2 - select alternate font 2
  • 13 - ALT-FONT-3 - select alternate font 3
  • 14 - ALT-FONT-4 - select alternate font 4
  • 15 - ALT-FONT-5 - select alternate font 5
  • 16 - ALT-FONT-6 - select alternate font 6
  • 17 - ALT-FONT-7 - select alternate font 7
  • 18 - ALT-FONT-1 - select alternate font 1
  • 19 - ALT-FONT-1 - select alternate font 1
  • 20 - FRAKTUR - Fraktur font
  • 21 - DOUBLEUNDER - double underline
  • 22 - -DIM - dim off
  • 23 - -ITALIC - italic off
  • 24 - -UNDERLINE - underline off
  • 25 - -BLINK - blink off
  • 26 - -FASTBLINK - fastblink off
  • 27 - -REVERSE - reverse off
  • 28 - -INVISIBLE - invisible off
  • 29 - -DELETED - deleted off

Init strings


Cap strings

soString of commands to enter standout mode.
seString of commands to leave standout mode.
sgNumeric capability, the width on the screen of the magic cookie. This capability is absent in terminals that record appearance modes character by character.
msFlag whose presence means that it is safe to move the cursor while the appearance modes are not in the normal state. If this flag is absent, programs should always reset the appearance modes to normal before moving the cursor.
xsFlag whose presence means that the only way to reset appearance modes already on the screen is to clear to end of line. On a per-character terminal, you must clear the area where the modes are set. On a magic cookie terminal, you must clear an area containing the cookie. See the discussion above.
xtFlag whose presence means that the cursor cannot be positioned right in front of a magic cookie, and that seis a command to delete the next magic cookie following the cursor. See discussion above.
mbString of commands to enter blinking mode.
mdString of commands to enter double-bright mode.
mhString of commands to enter half-bright mode.
mkString of commands to enter invisible mode.
mpString of commands to enter protected mode.
mrString of commands to enter reverse-video mode.
meString of commands to turn off all appearance modes, including standout mode and underline mode. On some terminals it also turns off alternate character set mode; on others, it may not. This capability must be present if any of mb... mris present.
asString of commands to turn on alternate character set mode. This mode assigns some or all graphic characters an alternate picture on the screen. There is no standard as to what the alternate pictures look like.
aeString of commands to turn off alternate character set mode.
saString of commands to turn on an arbitrary combination of appearance modes. It accepts 9 parameters, each of which controls a particular kind of appearance mode. A parameter should be 1 to turn its appearance mode on, or zero to turn that mode off. Most terminals do not support the sacapability, even among those that do have various appearance modes. The nine parameters are, in order,
  1. standout
  2. underline
  3. reverse
  4. blink
  5. half-bright
  6. double-bright
  7. blank
  8. protect
  9. alt char set

Variable and Function Index

For stty

  • BC: tgoto
  • ospeed: Output Padding
  • PC: Output Padding
  • tgetent: Find
  • tgetflag: Interrogate
  • tgetnum: Interrogate
  • tgetstr: Interrogate
  • tgoto: tgoto
  • tparam: tparam
  • tputs: Output Padding
  • UP: tgoto

Summary of Capability Names

Here are all the terminal capability names in alphabetical order with a brief description of each. For cross references to their definitions, see the index of capability names.

aeString to turn off alternate character set mode.
alString to insert a blank line before the cursor.
ALString to insert n blank lines before the cursor.
amFlag: output to last column wraps cursor to next line.
asString to turn on alternate character set
bcVery obsolete alternative name for the lecapability.
blString to sound the bell.
bsObsolete flag: ASCII backspace may be used for leftward motion.
btString to move the cursor left to the previous hardware tab stop column.
bwFlag: leat left margin wraps to end of previous line.
CCString to change terminal's command character.
cdString to clear the line the cursor is on, and following lines.
ceString to clear from the cursor to the end of the line.
chString to position the cursor at column c in the same line.
clString to clear the entire screen and put cursor at upper left corner.
cmString to position the cursor at line l, column c.
CMString to position the cursor at line l, column c, relative to display memory.
coNumber: width of the screen.
crString to move cursor sideways to left margin.
csString to set the scroll region.
cSAlternate form of string to set the scroll region.
ctString to clear all tab stops.
cvString to position the cursor at line l in the same column.
daFlag: data scrolled off top of screen may be scrolled back.
dbFlag: data scrolled off bottom of screen may be scrolled back.
dBObsolete number: msec of padding needed for the backspace character.
dcString to delete one character position at the cursor.
dCObsolete number: msec of padding needed for the carriage-return character.
DCString to delete n characters starting at the cursor.
dFObsolete number: msec of padding needed for the formfeed character.
dlString to delete the line the cursor is on.
DLString to delete n lines starting with the cursor's line.
dmString to enter delete mode.
dNObsolete number: msec of padding needed for the newline character.
doString to move the cursor vertically down one line.
DOString to move cursor vertically down n lines.
dsString to disable the display of the status line.
dTObsolete number: msec of padding needed for the tab character.
ecString of commands to clear n characters at cursor.
edString to exit delete mode.
eiString to leave insert mode.
eoFlag: output of a space can erase an overstrike.
esFlag: other display commands work while writing the status line.
ffString to advance to the next page, for a hardcopy terminal.
fsString to move the cursor back from the status line to its previous position (outside the status line).
gnFlag: this terminal type is generic, not real.
hcFlag: hardcopy terminal.
hdString to move the cursor down half a line.
hoString to position cursor at upper left corner.
hsFlag: the terminal has a status line.
huString to move the cursor up half a line.
hzFlag: terminal cannot accept ~as output.
i1String to initialize the terminal for each login session.
i3String to initialize the terminal for each login session.
icString to insert one character position at the cursor.
ICString to insert n character positions at the cursor.
ifString naming a file of commands to initialize the terminal.
imString to enter insert mode.
inFlag: outputting a space is different from moving over empty positions.
ipString to output following an inserted character in insert mode.
isString to initialize the terminal for each login session.
itNumber: initial spacing between hardware tab stop columns.
k0String of input sent by function key 0 or 10.
k1 ... k9Strings of input sent by function keys 1 through 9.
K1 ... K5Strings sent by the five other keys in 3-by-3 array with arrows.
kaString of input sent by the “clear all tabs” key.
kAString of input sent by the “insert line” key.
kbString of input sent by the “backspace” key.
kCString of input sent by the “clear screen” key.
kdString of input sent by typing the down-arrow key.
kDString of input sent by the “delete character” key.
keString to make the function keys work locally.
kEString of input sent by the “clear to end of line” key.
kFString of input sent by the “scroll forward” key.
khString of input sent by typing the “home-position” key.
kHString of input sent by the “home down” key.
kIString of input sent by the “insert character” or “enter insert mode” key.
klString of input sent by typing the left-arrow key.
kLString of input sent by the “delete line” key.
kmFlag: the terminal has a Meta key.
kMString of input sent by the “exit insert mode” key.
knNumeric value, the number of numbered function keys.
kNString of input sent by the “next page” key.
koVery obsolete string listing the terminal's named function keys.
kPString of input sent by the “previous page” key.
krString of input sent by typing the right-arrow key.
kRString of input sent by the “scroll reverse” key.
ksString to make the function keys transmit.
kSString of input sent by the “clear to end of screen” key.
ktString of input sent by the “clear tab stop this column” key.
kTString of input sent by the “set tab stop in this column” key.
kuString of input sent by typing the up-arrow key.
l0String on keyboard labelling function key 0 or 10.
l1 ... l9Strings on keyboard labelling function keys 1 through 9.
leString to move the cursor left one column.
LEString to move cursor left n columns.
liNumber: height of the screen.
llString to position cursor at lower left corner.
lmNumber: lines of display memory.
LPFlag: writing to last column of last line will not scroll.
mbString to enter blinking mode.
mdString to enter double-bright mode.
meString to turn off all appearance modes
mhString to enter half-bright mode.
miFlag: cursor motion in insert mode is safe.
mkString to enter invisible mode.
mmString to enable the functioning of the Meta key.
moString to disable the functioning of the Meta key.
mpString to enter protected mode.
mrString to enter reverse-video mode.
msFlag: cursor motion in standout mode is safe.
ncObsolete flag: do not use ASCII carriage-return on this terminal.
ndString to move the cursor right one column.
NFFlag: do not use XON/XOFF flow control.
nlObsolete alternative name for the doand sfcapabilities.
nsFlag: the terminal does not normally scroll for sequential output.
nwString to move to start of next line, possibly clearing rest of old line.
osFlag: terminal can overstrike.
pbNumber: the lowest baud rate at which padding is actually needed.
pcString containing character for padding.
pfString to terminate redirection of output to the printer.
poString to redirect further output to the printer.
pOString to redirect n characters ofoutput to the printer.
psString to print the screen on the attached printer.
rcString to move to last saved cursor position.
RIString to move cursor right n columns.
rpString to output character c repeated n times.
rsString to reset the terminal from any strange modes.
saString to turn on an arbitrary combination of appearance modes.
scString to save the current cursor position.
seString to leave standout mode.
sfString to scroll the screen one line up.
SFString to scroll the screen n lines up.
sgNumber: width of magic standout cookie. Absent if magic cookies are not used.
soString to enter standout mode.
srString to scroll the screen one line down.
SRString to scroll the screen n line down.
stString to set tab stop at current cursor column on all lines. programs.
taString to move the cursor right to the next hardware tab stop column.
teString to return terminal to settings for sequential output.
tiString to initialize terminal for random cursor motion.
tsString to move the terminal cursor into the status line.
ucString to underline one character and move cursor right.
ueString to turn off underline mode
ugNumber: width of underlining magic cookie. Absent if underlining doesn't use magic cookies.
ulFlag: underline by overstriking with an underscore.
upString to move the cursor vertically up one line.
UPString to move cursor vertically up n lines.
usString to turn on underline mode
vbString to make the screen flash.
veString to return the cursor to normal.
viString to make the cursor invisible.
vsString to enhance the cursor.
wiString to set the terminal output screen window.
wsNumber: the width of the status line.
xbFlag: superbee terminal.
xnFlag: cursor wraps in a strange way.
xsFlag: clearing a line is the only way to clear the appearance modes of positions in that line (or, only way to remove magic cookies on that line).
xtFlag: Teleray 1061; several strange characteristics.

Variable and Function Index

  • BC: tgoto
  • ospeed: Output Padding
  • PC: Output Padding
  • tgetent: Find
  • tgetflag: Interrogate
  • tgetnum: Interrogate
  • tgetstr: Interrogate
  • tgoto: tgoto
  • tparam: tparam
  • tputs: Output Padding
  • UP: tgoto

  • ae: Standout
  • AL: Insdel Line
  • al: Insdel Line
  • am: Wrapping
  • as: Standout
  • bc: Cursor Motion
  • bl: Bell
  • bs: Cursor Motion
  • bt: Cursor Motion
  • bw: Cursor Motion
  • CC: Basic
  • cd: Clearing
  • ce: Clearing
  • ch: Cursor Motion
  • cl: Clearing
  • CM: Cursor Motion
  • cm: Cursor Motion
  • co: Screen Size
  • cr: Cursor Motion
  • cS: Scrolling
  • cs: Scrolling
  • ct: Initialization
  • cv: Cursor Motion
  • da: Scrolling
  • dB: Pad Specs
  • db: Scrolling
  • dC: Pad Specs
  • DC: Insdel Char
  • dc: Insdel Char
  • dF: Pad Specs
  • DL: Insdel Line
  • dl: Insdel Line
  • dm: Insdel Char
  • dN: Pad Specs
  • DO: Cursor Motion
  • do: Cursor Motion
  • ds: Status Line
  • dT: Pad Specs
  • ec: Clearing
  • ed: Insdel Char
  • ei: Insdel Char
  • eo: Basic
  • es: Status Line
  • ff: Cursor Motion
  • fs: Status Line
  • gn: Basic
  • hc: Basic
  • hd: Half-Line
  • ho: Cursor Motion
  • hs: Status Line
  • hu: Half-Line
  • hz: Basic
  • i1: Initialization
  • i3: Initialization
  • IC: Insdel Char
  • ic: Insdel Char
  • if: Initialization
  • im: Insdel Char
  • in: Insdel Char
  • ip: Insdel Char
  • is: Initialization
  • it: Initialization
  • K1...K5: Keypad
  • k1...k9: Keypad
  • kA...kT: Keypad
  • ka...ku: Keypad
  • km: Meta Key
  • l0...l9: Keypad
  • LE: Cursor Motion
  • le: Cursor Motion
  • li: Screen Size
  • ll: Cursor Motion
  • lm: Scrolling
  • LP: Wrapping
  • mb: Standout
  • md: Standout
  • me: Standout
  • mh: Standout
  • mi: Insdel Char
  • mk: Standout
  • mm: Meta Key
  • mo: Meta Key
  • mp: Standout
  • mr: Standout
  • ms: Underlining
  • ms: Standout
  • nc: Cursor Motion
  • nd: Cursor Motion
  • NF: Initialization
  • nl: Cursor Motion
  • ns: Scrolling
  • nw: Cursor Motion
  • os: Basic
  • pb: Pad Specs
  • pc: Pad Specs
  • pf: Printer
  • pO: Printer
  • po: Printer
  • ps: Printer
  • rc: Cursor Motion
  • RI: Cursor Motion
  • rp: Basic
  • rs: Initialization
  • sa: Standout
  • sc: Cursor Motion
  • se: Standout
  • SF: Scrolling
  • sf: Scrolling
  • sg: Standout
  • so: Standout
  • SR: Scrolling
  • sr: Scrolling
  • st: Initialization
  • ta: Cursor Motion
  • te: Initialization
  • ti: Initialization
  • ts: Status Line
  • uc: Underlining
  • ue: Underlining
  • ug: Underlining
  • ul: Underlining
  • UP: Cursor Motion
  • up: Cursor Motion
  • us: Underlining
  • vb: Bell
  • ve: Cursor Visibility
  • vi: Cursor Visibility
  • vs: Cursor Visibility
  • wi: Windows
  • ws: Status Line
  • xb: Basic
  • xn: Wrapping
  • xs: Standout
  • xt: Standout
  • xt: Cursor Motion

  • Basic: Basic characteristics.
  • Screen Size: Screen size, and what happens when it changes.
  • Cursor Motion: Various ways to move the cursor.
  • Wrapping: What happens if you write a character in the last column.
  • Scrolling: Pushing text up and down on the screen.
  • Windows: Limiting the part of the window that output affects.
  • Clearing: Erasing one or many lines.
  • Insdel Line: Making new blank lines in mid-screen; deleting lines.
  • Insdel Char: Inserting and deleting characters within a line.
  • Standout: Highlighting some of the text.
  • Underlining: Underlining some of the text.
  • Cursor Visibility: Making the cursor more or less easy to spot.
  • Bell: Attracts user's attention; not localized on the screen.
  • Keypad: Recognizing when function keys or arrows are typed.
  • Meta Key: META acts like an extra shift key.
  • Initialization: Commands used to initialize or reset the terminal.
  • Pad Specs: Info for the kernel on how much padding is needed.
  • Status Line: A status line displays background information.
  • Half-Line: Moving by half-lines, for superscripts and subscripts.
  • Printer: Controlling auxiliary printers of display terminals.

Translated Term Capabilities

This is helpful so you can understand what a term cap does, by looking at the long name.

Tput NameTerminfo Long Name

List of All Terminals

You can view this list with the following command:

$ toe -a|sort -d

VT100 keypad Diagram


Here's a diagram of the VT100 keypad keys with their bindings. The top line is the name of the key (some DEC keyboards have the keys labelled somewhat differently, like GOLD instead of PF1, but this is the most "official" name). The second line is the escape sequence it generates in Application Keypad mode (where "$" means the ESC character). The third line contains two items, first the mapping of the key in terminfo, and then in termcap.

  |   PF1   |   PF2   |   PF3   |   PF4   |
  |   $OP   |   $OQ   |   $OR   |   $OS   |
  |    7         8         9         -    |
  |   $Ow   |   $Ox   |   $Oy   |   $Om   |
  |    4    |    5    |    6    |    ,    |
  |   $Ot   |   $Ou   |   $Ov   |   $Ol   |
  |    1    |    2    |    3    |         |
  |   $Oq   |   $Or   |   $Os   |  enter  |
  |_ka1__K1_|_kb2__K2_|_ka3__K3_|  $OM    |
  |         0         |   .     |         |
  |        $Op        |  $On    |         |

A better adaptation to modern keyboards such as the PC's, which have a dozen function keys and the keypad 2,4,6,8 keys are labeled with arrows keys, is to use the 5-key arrangement to model the arrow keys as suggested in the terminfo guidelines:

  |   PF1   |   PF2   |   PF3   |   PF4   |
  |   $OP   |   $OQ   |   $OR   |   $OS   |
  |    7         8         9         -    |
  |   $Ow   |   $Ox   |   $Oy   |   $Om   |
  |    4    |    5    |    6    |    ,    |
  |   $Ot   |   $Ou   |   $Ov   |   $Ol   |
  |    1    |    2    |    3    |         |
  |   $Oq   |   $Or   |   $Os   |  enter  |
  |_kc1__K4_|_________|_kc3__K5_|  $OM    |
  |         0         |   .     |         |
  |        $Op        |  $On    |         |

SGR parameter values

0default mode (attributes off)
5slow blink
6fast blink
7reverse video
9crossed-out (marked for deletion)
10primary font [10 + n (n in 1..9) = nth alternative font]
21double underline
22turn off 2
23turn off 3
24turn off 4
25turn off 5
26proportional spacing
27turn off 7
28turn off 8
29turn off 9
30black fg
31red fg
32green fg
33yellow fg
34blue fg
35magenta fg
36cyan fg
37white fg
38set fg color as in CCIT T.416
39set default fg color
40black bg
41red bg
42green bg
43yellow bg
44blue bg
45magenta bg
46cyan bg
47white bg
48set bg color as in CCIT T.416
39set default bg color
50turn off 26
54turn off 51 & 52
55not overlined
61-65variable highlights for ideograms.
Sequence     Sequence                             Parameter   or
Mnemonic     Name              Sequence           Value      Mode   terminfo
APC  Applicatn Program Command E _                -         Delim  -
BEL  Bell *                    ^G                  -         -      bel
BPH  Break Permitted Here *    E B                -         *      -
BS   Backpace *                ^H                  -         EF     -
CAN  Cancel *                  ^X                  -         -      -   (A)
CBT  Cursor Backward Tab       E [ Pn Z           1         eF     cbt
CCH  Cancel Previous Character E T                -         -      -
CHA  Cursor Horizntal Absolute E [ Pn G           1         eF     hpa (B)
CHT  Cursor Horizontal Tab     E [ Pn I           1         eF     tab (C)
CMD  Coding Method Delimiter * E
CNL  Cursor Next Line          E [ Pn E           1         eF     nel (D)
CPL  Cursor Preceding Line     E [ Pn F           1         eF     -
CPR  Cursor Position Report    E [ Pn ; Pn R      1, 1      -      -   (E)
CSI  Control Sequence Intro    E [                -         Intro  -
CTC  Cursor Tabulation Control E [ Ps W           0         eF     -   (F)
CUB  Cursor Backward           E [ Pn D           1         eF     cub
CUD  Cursor Down               E [ Pn B           1         eF     cud
CUF  Cursor Forward            E [ Pn C           1         eF     cuf
CUP  Cursor Position           E [ Pn ; Pn H      1, 1      eF     cup (G)
CUU  Cursor Up                 E [ Pn A           1         eF     cuu
CVT  Cursor Vertical Tab       E [ Pn Y           -         eF     -   (H)
DA   Device Attributes         E [ Pn c           0         -      -
DAQ  Define Area Qualification E [ Ps o           0         -      -
DCH  Delete Character          E [ Pn P           1         eF     dch
DCS  Device Control String     E P                -         Delim  -
DL   Delete Line               E [ Pn M           1         eF     dl
DLE  Data Link Escape *        ^P                  -         -      -
DMI  Disable Manual Input      E                 -         Fs     -
DSR  Device Status Report      E [ Ps n           0         -      -   (I)
DTA  Dimension Text Area *     E [ Pn ; Pn SPC T  -         PC     -
EA   Erase in Area             E [ Ps O           0         eF     -   (J)
ECH  Erase Character           E [ Pn X           1         eF     ech
ED   Erase in Display          E [ Ps J           0         eF     ed  (J)
EF   Erase in Field            E [ Ps N           0         eF     -
EL   Erase in Line             E [ Ps K           0         eF     el  (J)
EM   End of Medium *           ^Y                  -         -      -
EMI  Enable Manual Input       E b                          Fs     -
ENQ  Enquire                   ^E                  -         -      -
EOT  End Of Transmission       ^D                  -         *      -
EPA  End of Protected Area     E W                -         -      -   (K)
ESA  End of Selected Area      E G                -         -      -
ESC  Escape                    ^[                  -         -      -
ETB  End Transmission Block    ^W                  -         -      -
ETX  End of Text               ^C                  -         -      -
FF   Form Feed                 ^L                  -         -      -
FNK  Function Key *            E [ Pn SPC W       -         -      -
GCC  Graphic Char Combination* E [ Pn ; Pn SPC B  -         -      -
FNT  Font Selection            E [ Pn ; Pn SPC D  0, 0      FE     -
GSM  Graphic Size Modify       E [ Pn ; Pn SPC B  100, 100  FE     -   (L)
GSS  Graphic Size Selection    E [ Pn SPC C       none      FE     -
HPA  Horz Position Absolute    E [ Pn `           1         FE     -   (B)
HPB  Char Position Backward    E [ j              1         FE     -
HPR  Horz Position Relative    E [ Pn a           1         FE     -   (M)
HT   Horizontal Tab *          ^I                  -         FE     -   (N)
HTJ  Horz Tab w/Justification  E I                -         FE     -
HTS  Horizontal Tab Set        E H                -         FE     hts
HVP  Horz & Vertical Position  E [ Pn ; Pn f      1, 1      FE     -   (G)
ICH  Insert Character          E [ Pn @           1         eF     ich
IDCS ID Device Control String  E [ SPC O          -         *      -
IGS  ID Graphic Subrepertoire  E [ SPC M          -         *      -
IL   Insert Line               E [ Pn L           1         eF     il
IND  Index                     E D                -         FE     -
INT  Interrupt                 E a                -         Fs     -
JFY  Justify                   E [ Ps SPC F       0         FE     -
IS1  Info Separator #1 *       ^_                  -         *      -
IS2  Info Separator #1 *       ^^                  -         *      -
IS3  Info Separator #1 *       ^]                  -         *      -
IS4  Info Separator #1 *       ^                  -         *      -
LF   Line Feed                 ^J                  -         -      -
LS1R Locking Shift Right 1 *   E ~                -         -      -
LS2  Locking Shift 2 *         E n                -         -      -
LS2R Locking Shift Right 2 *   E }                -         -      -
LS3  Locking Shift 3 *         E o                -         -      -
LS3R Locking Shift Right 3 *   E |                -         -      -
MC   Media Copy                E [ Ps i           0         -      -   (S)
MW   Message Waiting           E U                -         -      -
NAK  Negative Acknowledge *    ^U                  -         *      -
NBH  No Break Here *           E C                -         -      -
NEL  Next Line                 E E                -         FE     nel (D)
NP   Next Page                 E [ Pn U           1         eF     -
NUL  Null *                    ^@                  -         -      -
OSC  Operating System Command  E ]                -         Delim  -
PEC  Pres. Expand/Contract *   E Pn SPC Z         0         -      -
PFS  Page Format Selection *   E Pn SPC J         0         -      -
PLD  Partial Line Down         E K                -         FE     -   (T)
PLU  Partial Line Up           E L                -         FE     -   (U)
PM   Privacy Message           E ^                -         Delim  -
PP   Preceding Page            E [ Pn V           1         eF     -
PPA  Page Position Absolute *  E [ Pn SPC P       1         FE     -
PPB  Page Position Backward *  E [ Pn SPC R       1         FE     -
PPR  Page Position Forward *   E [ Pn SPC Q       1         FE     -
PTX  Parallel Texts *          E [               -         -      -
PU1  Private Use 1             E Q                -         -      -
PU2  Private Use 2             E R                -         -      -
QUAD Typographic Quadding      E [ Ps SPC H       0         FE     -
REP  Repeat Char or Control    E [ Pn b           1         -      rep
RI   Reverse Index             E M                -         FE     -   (V)
RIS  Reset to Initial State    E c                -         Fs     -
RM   Reset Mode *              E [ Ps l           -         -      -   (W)
SACS Set Add. Char. Sep. *     E [ Pn SPC /       0         -      -
SAPV Sel. Alt. Present. Var. * E [ Ps SPC ]       0         -      -   (X)
SCI  Single-Char Introducer    E Z                -         -      -
SCO  Sel. Char. Orientation *  E [ Pn ; Pn SPC k  -         -      -
SCS  Set Char. Spacing *       E [ Pn SPC g       -         -      -
SD   Scroll Down               E [ Pn T           1         eF     rin
SDS  Start Directed String *   E [ Pn ]           1         -      -
SEE  Select Editing Extent     E [ Ps Q           0         -      -   (Y)
SEF  Sheet Eject & Feed *  E [ Ps ; Ps SPC Y  0,0       -      -
SGR  Select Graphic Rendition  E [ Ps m           0         FE     sgr (O)
SHS  Select Char. Spacing *    E [ Ps SPC K       0         -      -
SI   Shift In                  ^O                  -         -      -   (P)
SIMD Sel. Imp. Move Direct. *  E [ Ps ^           -         -      -
SL   Scroll Left               E [ Pn SPC @       1         eF     -
SLH  Set Line Home *           E [ Pn SPC U       -         -      -
SLL  Set Line Limit *          E [ Pn SPC V       -         -      -
SLS  Set Line Spacing *        E [ Pn SPC h       -         -      -
SM   Select Mode               E [ Ps h           none      -      -   (W)
SO   Shift Out                 ^N                  -         -      -   (Q)
SOH  Start Of Heading *        ^A                  -         -      -
SOS  Start of String *         E X                -         -      -
SPA  Start of Protected Area   E V                -         -      -   (Z)
SPD  Select Pres. Direction *  E [ Ps ; Ps SPC S  0,0       -      -
SPH  Set Page Home *           E [ Ps SPC G       -         -      -
SPI  Spacing Increment         E [ Pn ; Pn SPC G  none      FE     -
SPL  Set Page Limit *          E [ Ps SPC j       -         -      -
SPQR Set Pr. Qual. & Rapid. *  E [ Ps SPC X       0         -      -
SR   Scroll Right              E [ Pn SPC A       1         eF     -
SRCS Set Reduced Char. Sep. *  E [ Pn SPC f       0         -      -
SRS  Start Reversed String *   E [ Ps [           0         -      -
SSA  Start of Selected Area    E F                -         -      -
SSU  Select Size Unit *        E [ Pn SPC I       0         -      -
SSW  Set Space Width *         E [ Pn SPC [       none      -      -
SS2  Single Shift 2 (G2 set)   E N                -         Intro  -
SS3  Single Shift 3 (G3 set)   E O                -         Intro  -
ST   String Terminator         E                 -         Delim  -
STAB Selective Tabulation *    E [ Pn SPC ^       -         -      -
STS  Set Transmit State        E S                -         -      -
STX  Start pf Text *           ^B                  -         -      -
SU   Scroll Up                 E [ Pn S           1         eF     indn
SUB  Substitute *              ^Z                  -         -      -
SVS  Select Line Spacing *     E [ Pn SPC        1         -      -
SYN  Synchronous Idle *        ^F                  -         -      -
TAC  Tabul. Aligned Centered * E [ Pn SPC b       -         -      -
TALE Tabul. Al. Leading Edge * E [ Pn SPC a       -         -      -
TATE Tabul. Al. Trailing Edge* E [ Pn SPC `       -         -      -
TBC  Tab Clear                 E [ Ps g           0         FE     tbc
TCC  Tabul. Centered on Char * E [ Pn SPC c       -         -      -
TSR  Tabulation Stop Remove  * E [ Pn SPC d       -         FE     -
TSS  Thin Space Specification  E [ Pn SC E        none      FE     -
VPA  Vert. Position Absolute   E [ Pn d           1         FE     vpa
VPB  Line Position Backward *  E [ Pn k           1         FE     -
VPR  Vert. Position Relative   E [ Pn e           1         FE     -   (R)
VPR  Vert. Position Relative   E [ Pn e           1         FE     -   (R)
VT   Vertical Tabulation *     ^K                  -         FE     -
VTS  Vertical Tabulation Set   E J                -         FE     -

Basic Characteristics

This section documents the capabilities that describe the basic and nature of the terminal, and also those that are relevant to the output of graphic characters.

osFlag whose presence means that the terminal can overstrike. This means that outputting a graphic character does not erase whatever was present in the same character position before. The terminals that can overstrike include printing terminals, storage tubes (all obsolete nowadays), and many bit-map displays.
eoFlag whose presence means that outputting a space erases a character position even if the terminal supports overstriking. If this flag is not present and overstriking is supported, output of a space has no effect except to move the cursor. (On terminals that do not support overstriking, you can always assume that outputting a space at a position erases whatever character was previously displayed there.)
gnFlag whose presence means that this terminal type is a generic type which does not really describe any particular terminal. Generic types are intended for use as the default type assigned when the user connects to the system, with the intention that the user should specify what type he really has. One example of a generic type is the type network. Since the generic type cannot say how to do anything interesting with the terminal, termcap-using programs will always find that the terminal is too weak to be supported if the user has failed to specify a real terminal type in place of the generic one. The gnflag directs these programs to use a different error message: “You have not specified your real terminal type”, rather than “Your terminal is not powerful enough to be used”.
hcFlag whose presence means this is a hardcopy terminal.
rpString of commands to output a graphic character c, repeated n times. The first parameter value is the ASCII code for the desired character, and the second parameter is the number of times to repeat the character. Often this command requires padding proportional to the number of times the character is repeated. This effect can be had by using parameter arithmetic with %-sequences to compute the amount of padding, then generating the result as a number at the front of the string so that tputs will treat it as padding.
hzFlag whose presence means that the ASCII character cannot be output on this terminal because it is used for display commands. Programs handle this flag by checking all text to be output and replacing each ~with some other character(s). If this is not done, the screen will be thoroughly garbled. The old Hazeltine terminals that required such treatment are probably very rare today, so you might as well not bother to support this flag.
CCString whose presence means the terminal has a settable command character. The value of the string is the default command character (which is usually <ESC>). All the strings of commands in the terminal description should be written to use the default command character. If you are writing an application program that changes the command character, use the CCcapability to figure out how to translate all the display commands to work with the new command character. Most programs have no reason to look at the CCcapability.
xbFlag whose presence identifies Superbee terminals which are unable to transmit the characters <ESC> and Control-C. Programs which support this flag are supposed to check the input for the code sequences sent by the <F1> and <F2> keys, and pretend that <ESC> or Control-C (respectively) had been read. But this flag is obsolete, and not worth supporting.

7bit vs. 8bit

These recommendations are optional. IBCS2 allows the leading escape to # be either the 7-bit E[ or 8-bit \233 introducer, in accordance with # the ANSI X.364/ISO 6429/ECMA-48 standard.

1.6.1 Describing the Encoding

For example, the cm string for a standard ANSI terminal is written as E[%i%d;%dH. (E stands for .) cm by convention always requires two parameters, the vertical and horizontal goal positions, so this string specifies the encoding of two parameters. Here %i increments the two values supplied, and each %d encodes one of the values in decimal. If the cursor position values 20,58 are encoded with this string, the result is E[21;59H.

First, here are the %-sequences that generate output. Except for %%, each of them encodes one parameter and advances the pointer to the following parameter.

  • %% Output a single %. This is the only way to represent a literal % in a terminal command with parameters. %% does not use up a parameter.
  • %d As in printf, output the next parameter in decimal.
  • %2 Like %02d in printf: output the next parameter in decimal, and always use at least two digits.
  • %3 Like %03d in printf: output the next parameter in decimal, and always use at least three digits. Note that %4 and so on are _not_ defined.
  • %. Output the next parameter as a single character whose ASCII code is the parameter value. Like %c in printf.
  • %+CHAR Add the next parameter to the character CHAR, and output the resulting character. For example, %+ represents 0 as a space, 1 as !, etc.

The following %-sequences specify alteration of the parameters (their values, or their order) rather than encoding a parameter for output. They generate no output; they are used only for their side effects on the parameters. Also, they do not advance the "next parameter" pointer except as explicitly stated. Only %i, %r and %> are defined in standard Unix termcap. The others are GNU extensions.

  • %i Increment the next two parameters. This is used for terminals that expect cursor positions in origin 1. For example, %i%d,%d would output two parameters with 1 for 0, 2 for 1, etc.
  • %r Interchange the next two parameters. This is used for terminals whose cursor positioning command expects the horizontal position first.
  • %s Skip the next parameter. Do not output anything.
  • %b Back up one parameter. The last parameter used will become once again the next parameter to be output, and the next output command will use it. Using %b more than once, you can back up any number of parameters, and you can refer to each parameter any number of times.
  • %>C1C2 Conditionally increment the next parameter. Here C1 and C2 are characters which stand for their ASCII codes as numbers. If the next parameter is greater than the ASCII code of C1, the ASCII code of C2 is added to it.
  • %a OP TYPE POS Perform arithmetic on the next parameter, do not use it up, and do not output anything. Here OP specifies the arithmetic operation, while TYPE and POS together specify the other operand.

Spaces are used above to separate the operands for clarity; the spaces don't appear in the data base, where this sequence is exactly five characters long. The character OP says what kind of arithmetic operation to perform. It can be any of these characters:

  • = - assign a value to the next parameter, ignoring its old value. The new value comes from the other operand.
  • + - add the other operand to the next parameter.
  • - - subtract the other operand from the next parameter.
  • * - multiply the next parameter by the other operand.
  • / - divide the next parameter by the other operand.

The "other operand" may be another parameter's value or a constant; the character TYPE says which. It can be:

  • p - Use another parameter. The character POS says which parameter to use. Subtract 64 from its ASCII code to get the position of the desired parameter relative to this one. Thus, the character A as POS means the parameter after the next one; the character ? means the parameter before the next one.
  • c - Use a constant value. The character POS specifies the value of the constant. The 0200 bit is cleared out, so that 0200 can be used to represent zero.

The following %-sequences are special purpose hacks to compensate for the weird designs of obscure terminals. They modify the next parameter or the next two parameters but do not generate output and do not use up any parameters. %m is a GNU extension; the others are defined in standard Unix termcap.

  • %n - Exclusive-or the next parameter with 0140, and likewise the parameter after next.
  • %m - Complement all the bits of the next parameter and the parameter after next.
  • %B - Encode the next parameter in BCD. It alters the value of the parameter by adding six times the quotient of the parameter by ten. Here is a C statement that shows how the new value is computed: PARM = (PARM / 10) * 16 + PARM % 10;
  • %D - Transform the next parameter as needed by Delta Data terminals. This involves subtracting twice the remainder of the parameter by 16. PARM -= 2 * (PARM % 16);

Terminal Type Name Conventions

Here is a list of standard suffixes and their conventional meanings:

  • -w - Short for "wide". This is a mode that gives the terminal more columns than usual. This is normally a user option.
  • -am - "Automatic margins". This is an alternate description for use when the terminal's margin-wrap switch is on; it contains the am flag. The implication is that normally the switch is off and the usual description for the terminal says that the switch is off.
  • -nam - "No automatic margins". The opposite of -am, this names an alternative description which lacks the am flag. This implies that the terminal is normally operated with the margin-wrap switch turned on, and the normal description of the terminal says so.
  • -na - "No arrows". This terminal description initializes the terminal to keep its arrow keys in local mode. This is a user option.
  • -rv - "Reverse video". This terminal description causes text output for normal video to appear as reverse, and text output for reverse video to come out as normal. Often this description differs from the usual one by interchanging the two strings which turn reverse video on and off.

This is a user option; you can choose either the "reverse video" variant terminal type or the normal terminal type, and termcap will obey.

  • -s - "Status". Says to enable use of a status line which ordinary output does not touch (*note Status Line::).

Some terminals have a special line that is used only as a status line. For these terminals, there is no need for an -s variant; the status line commands should be defined by default. On other terminals, enabling a status line means removing one screen line from ordinary use and reducing the effective screen height. For these terminals, the user can choose the -s variant type to request use of a status line.

  • -NLINES - Says to operate with NLINES lines on the screen, for terminals such as the Ambassador which provide this as an option. Normally this is a user option; by choosing the terminal type, you control how many lines termcap will use.
  • -NPAGESp - Says that the terminal has NPAGES pages worth of screen memory, for terminals where this is a hardware option.
  • -unk - Says that description is not for direct use, but only for reference in tc capabilities. Such a description is a kind of subroutine, because it describes the common characteristics of several variant descriptions that would use other suffixes in place of -unk.


Here is a description of the color and attribute controls supported in the ANSI.SYS driver under MS-DOS. Most console drivers and ANSI terminal emulators for Intel boxes obey these. They are a proper subset of the ECMA-48 escapes.

Bright black becomes gray, bright brown becomes yellow. These coincide with the prescriptions of the ISO 6429/ECMA-48 standard. * If the 5 attribute is on and you set a background color (40-47) it is supposed to enable bright background.

0        all attributes off
1        foreground bright
4        underscore on
5        blink on/background bright (not reliable with brown)
7        reverse-video
8        set blank (non-display)
10       set primary font
11       set first alternate font (on PCs, display ROM characters 1-31)
12       set second alternate font (on PCs, display IBM high-half chars)
3n       set foreground color       / 0=black, 1=red,     2=green, 3=brown,
4n       set background color        4=blue,  5=magenta, 6=cyan,  7=white


Stty Control Settings

parenbparenb Generate parity bit in output and expect parity bit in input. May be negated.
paroddSet odd parity (even if negated). May be negated.
cs5, cs6, cs7, cs8Set character size to 5, 6, 7, or 8 bits.
hup, hupclSend a hangup signal when the last process closes the tty. May be negated.
cstopbUse two stop bits per character (one if negated). May be negated.
creadAllow input to be received. May be negated.
clocalDisable modem control signals. May be negated.
crtsctsEnable RTS/CTS flow control. Disables DTR/DSR flow control. Non-POSIX. May be negated.
cdtrdsrEnable DTR/DSR flow control. Disables RTS/CTS flow control. Non-POSIX. May be negated. No stty-readable form available. It needs to be supported by device. Usage on device without DTR/DSR support could lead to an error and failure of stty.

Stty Input settings

ignbrkIgnore break characters. May be negated.
brkintMake breaks cause an interrupt signal. May be negated.
ignparIgnore characters with parity errors. May be negated.
parmrkMark parity errors (with a 255-0-character sequence). May be negated.
inpckEnable input parity checking. May be negated.
istripClear high (8th) bit of input characters. May be negated.
inlcrTranslate newline to carriage return. May be negated.
igncrIgnore carriage return. May be negated.
icrnlTranslate carriage return to newline. May be negated.
iutf8Assume input characters are UTF-8 encoded. May be negated.
ixonEnable XON/XOFF flow control (that is, CTRL-S/CTRL-Q). May be negated.
ixoff, tandemEnable sending of stop character when the system input buffer is almost full, and start character when it becomes almost empty again. May be negated.
iuclcTranslate uppercase characters to lowercase. Non-POSIX. May be negated.
ixanyAllow any character to restart output (only the start character if negated). Non-POSIX. May be negated.
imaxbelEnable beeping and not flushing input buffer if a character arrives when the input buffer is full. Non-POSIX. May be negated.

Stty Output settings

These arguments specify output-related operations.

opostPostprocess output. May be negated.
olcucTranslate lowercase characters to uppercase. Non-POSIX. May be negated.
ocrnlTranslate carriage return to newline. Non-POSIX. May be negated.
onlcrTranslate newline to carriage return-newline. Non-POSIX. May be negated.
onocrDo not print carriage returns in the first column. Non-POSIX. May be negated.
onlretNewline performs a carriage return. Non-POSIX. May be negated.
ofillUse fill (padding) characters instead of timing for delays. Non-POSIX. May be negated.
ofdelUse delete characters for fill instead of null characters. Non-POSIX. May be negated.
nl1, nl0Newline delay style. Non-POSIX.
cr3, cr2, cr1, cr0Carriage return delay style. Non-POSIX.
tab3, tab2, tab1, tab0Horizontal tab delay style. Non-POSIX.
bs1, bs0Backspace delay style. Non-POSIX.
vt1, vt0Vertical tab delay style. Non-POSIX.
ff1, ff0Form feed delay style. Non-POSIX.

Stty Local settings

isigEnable interrupt, quit, and suspend special characters. May be negated.
icanonEnable erase, kill, werase, and rprnt special characters. May be negated.
iextenEnable non-POSIX special characters. May be negated.
echoEcho input characters. May be negated.
echoe, crteraseEcho erase characters as backspace-space-backspace. May be negated.
echokEcho a newline after a kill character. May be negated.
echonlEcho newline even if not echoing other characters. May be negated.
noflshDisable flushing after interrupt and quit special characters. May be negated.
xcaseEnable input and output of uppercase characters by preceding their lowercase equivalents with , when icanon is set. Non-POSIX. May be negated.
tostopStop background jobs that try to write to the terminal. Non-POSIX. May be negated.
echoprt, prteraseEcho erased characters backward, between and /. Non-POSIX. May be negated.
echoctl, ctlechoEcho control characters in hat notation (^C) instead of literally. Non-POSIX. May be negated.
echoke, crtkillEcho the kill special character by erasing each character on the line as indicated by the echoprt and echoe settings, instead of by the echoctl and echok settings. Non-POSIX. May be negated.

Stty Combination settings

evenp, paritySame as parenb -parodd cs7. May be negated. If negated, same as -parenb cs8.
oddpSame as parenb parodd cs7. May be negated. If negated, same as -parenb cs8.
nlSame as -icrnl -onlcr. May be negated. If negated, same as icrnl -inlcr -igncr onlcr -ocrnl -onlret.
ekReset the erase and kill special characters to their default values.
saneSets all special characters to their default values and:
cread -ignbrk brkint -inlcr -igncr icrnl -ixoff -iuclc -ixany imaxbel opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
cookedSame as brkint ignpar istrip icrnl ixon opost isig icanon, plus sets the eof and eol characters to their default values if they are the same as the min and time characters. May be negated. If negated, same as raw.
rawSame as:
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -opost -isig -icanon -xcase min 1 time 0
May be negated. If negated, same as cooked.
cbreakSame as -icanon. May be negated. If negated, same as icanon.
pass8Same as -parenb -istrip cs8. May be negated. If negated, same as parenb istrip cs7.
litoutSame as -parenb -istrip -opost cs8. May be negated. If negated, same as parenb istrip opost cs7.
decctlqSame as -ixany. Non-POSIX. May be negated.
tabsSame as tab0. Non-POSIX. May be negated. If negated, same as tab3.
lcase, LCASESame as xcase iuclc olcuc. Non-POSIX. May be negated.
crtSame as echoe echoctl echoke.
decSame as echoe echoctl echoke -ixany intr ^C erase ^? kill C-u.

Special characters

The special characters' default values vary from system to system. They are set with the syntax name value, where the names are listed below and the value can be given either literally, in hat notation (^C), or as an integer which may start with 0x to indicate hexadecimal, 0 to indicate octal, or any other digit to indicate decimal.

For GNU stty, giving a value of ^- or undef disables that special character. (This is incompatible with Ultrix stty, which uses a value of u to disable a special character. GNU stty treats a value u like any other, namely to set that special character to .)

intrSend an interrupt signal.
quitSend a quit signal.
eraseErase the last character typed.
killErase the current line.
eofSend an end of file (terminate the input).
eolEnd the line.
eol2Alternate character to end the line. Non-POSIX.
swtchSwitch to a different shell layer. Non-POSIX.
startRestart the output after stopping it.
stopStop the output.
suspSend a terminal stop signal.
dsuspSend a terminal stop signal after flushing the input. Non-POSIX.
rprntRedraw the current line. Non-POSIX.
weraseErase the last word typed. Non-POSIX.
lnextEnter the next character typed literally, even if it is a special character. Non-POSIX.

Special settings

  • min N - Set the minimum number of characters that will satisfy a read until the time value has expired, when -icanon is set.
  • time N - Set the number of tenths of a second before reads time out if the minimum number of characters have not been read, when -icanon is set.
  • ispeed N - Set the input speed to N.
  • ospeed N - Set the output speed to N.
  • rows N - Tell the tty kernel driver that the terminal has N rows. Non-POSIX.
  • cols N, columns N - Tell the kernel that the terminal has N columns. Non-POSIX.
  • size - Print the number of rows and columns that the kernel thinks the terminal has. (Systems that don't support rows and columns in the kernel typically use the environment variables LINES and COLUMNS instead; however, GNU stty does not know anything about them.) Non-POSIX.
  • line N - Use line discipline N. Non-POSIX.
  • speed - Print the terminal speed.
  • N - Set the input and output speeds to N. N can be one of: 0 50 75 110 134 134.5 150 200 300 600 1200 1800 2400 4800 9600 19200 38400 exta extb. exta is the same as 19200; extb is the same as 38400. 0 hangs up the line if -clocal is set.

Color Terminals

color256 ()
    local L=$(sed 's/[0-9]//g; s/./#/g' <<<`seq -s+0 $(($COLUMNS - 10))`);
    for i in `seq 0 $(tput colors)`;
    do printf " %.3d `tput setab $i`${L}${R} %.3d `tput setab 0;tput setaf 7`n" $i $i | tr '#' ' ';
for F in `find ~/.terminfo/ -type f | sed 's/^.*///' | xargs -P0 -I'TT' sh -c 'echo "$(tput -T TT colors): TT"'|sed '/^-/d'| grep ^16:|cut -d: -f2`; do
echo -e "nn";
pm $F; export TERM=$F; tput -T $F initc; color256; done
find ~/.terminfo/ -type f | sed 's/^.*///' | xargs -I'TT' sh -c 'echo "$(tput -T TT colors): TT"'|sed '/^-/d'

Terminals with 16 Colors

  • aixterm-16color
  • amiga-vnc
  • hp2397
  • hp2397a
  • hp+color
  • ibm+16color
  • konsole-16color
  • nsterm-16color
  • nsterm-7-c
  • nsterm-7-c-s
  • nsterm-acs-c
  • nsterm-acs-c-s
  • nsterm-c
  • nsterm+c
  • nsterm-c-7
  • nsterm-c-acs
  • nsterm-c-s
  • nsterm-c-s-7
  • nsterm-c-s-acs
  • rxvt-16color
  • screen-16color
  • screen-16color-bce
  • screen-16color-bce-s
  • screen-16color-s
  • xterm-16color

Terminals with 52 Colors

  • d430c-dg-ccc
  • d430c-unix-25-ccc
  • d430c-unix-ccc
  • d430c-unix-s-ccc
  • d430c-unix-sr-ccc
  • d430c-unix-w-ccc
  • d430-dg-ccc
  • d430-unix-25-ccc
  • d430-unix-ccc
  • d430-unix-s-ccc
  • d430-unix-sr-ccc
  • d430-unix-w-ccc
  • dg+ccc
  • dgunix+ccc

Terminals with 64 Colors

  • hpterm-color
  • wy370
  • wy370-101k
  • wy370-105k
  • wy370-EPC
  • wy370-nk
  • wy370-rv
  • wy370-vb
  • wy370-w
  • wy370-wvb
  • wyse370
  • Eterm-88color
  • rxvt-88color
  • xterm-88color
  • xterm+88color

Terminals with 256 colors

  • Eterm-256color
  • gnome-256color
  • konsole-256color
  • putty-256color
  • rxvt-256color
  • screen-256color
  • screen-256color-bce
  • screen-256color-bce-s
  • screen-256color-s
  • xterm-256color
  • xterm+256color

View All tput capabilities

function tputs(){ infocmp -1|sed 's/^[ 	]*//; /=/!d; s/=.*//g; /[#|]/d'; }

Some common terminfo parameter sequences, their termcap equivalents, and some terminal types which commonly have such sequences, are:

terminfo                    termcap   Representative Terminals
%p1%c                       %.        adm
%p1%d                       %d        hp, ANSI standard, vt100
%p1%+%c                 %+x       concept
%i                          %iq       ANSI standard, vt100
%p1%?%>%t%p1%+%;    %>xy      concept
%p2 is printed before %p1   %r        hp

Installing your Own Terminfo

MostLike, or if that is offline I uploaded a copy: mostlike - manpages with color looking like most

rm -rvf ~/.terminfo
mkdir -pv ~/.terminfo
curl -o terminfo.master; curl -Ss
export TERMINFO=~/.terminfo;
sudo tic -e screen-256color,screen-256color-s,screen-256color-bce,screen-256color-bce-s,xterm+256color,xterm,xterm-pcolor terminfo.src

256 Colors in Terminal

256 Colors (Background)

W=`tput setaf 7` RC="E[0;0;0m" L=$(sed 's/[0-9]//g; s/./ /g' <<<`seq -s+0 $(($COLUMNS/2))`);

for i in `seq 0 256`;
  printf "${W}n%.3d `tput setab $i`${L}${RC}" $i;

256 Colors (Foreground)

W=`tput setaf 7` WB=`tput setab 0` RC="E[0;0;0m" L=$(sed 's/[0-9]//g; s/./#/g' <<<`seq -s+0 $(($COLUMNS/2))`);
for i in `seq 0 256`;
  printf "${WB}n%.3d `tput setaf $i`${L}${RC}" $i;

Terminal Capabilities - Infocmp

infocmp -1Lq|grep -v "$TERM|#"|tr -d '	'

DEC/ANSI special sequences

List of the DEC/ANSI special sequences recognized:

----------------------------------------- ----------------------------------------- ----------------------------------------- ----------------------------------------- ----------------------------------------- -----------------------------------------
Action Meaning
%% The percent sign
%t The time the request was received in Universal Coordinated Time since the epoch (Jan. 1, 1970) measured in microseconds. The value is preceded by t=.
%D The time from when the request was received to the time the headers are sent on the wire. This is a measure of the duration of the request. The value is preceded by D=. The value is measured in microseconds.
%{VARNAME}e The contents of the environment variable VARNAME.
%{VARNAME}s The contents of the SSL environment variable VARNAME, if mod_ssl is enabled.
RIS full reset
SC save cursor
RC restore cursor
LL home-down
RSR reset scroll region
DECSTR soft reset (VT320)
S7C1T 7-bit controls (VT220)
ISO DEC G0 enable DEC graphics for G0
ISO UK G0 enable UK chars for G0
ISO US G0 enable US chars for G0
ISO DEC G1 enable DEC graphics for G1
ISO UK G1 enable UK chars for G1
ISO US G1 enable US chars for G1
DECPAM application keypad mode
DECPNM normal keypad mode
DECANSI enter ANSI mode
ECMA[+-]AM keyboard action mode
ECMA[+-]IRM insert replace mode
ECMA[+-]SRM send receive mode
ECMA[+-]LNM linefeed mode
DEC[+-]CKM application cursor keys
DEC[+-]ANM set VT52 mode
DEC[+-]COLM 132-column mode
DEC[+-]SCLM smooth scroll
DEC[+-]SCNM reverse video mode
DEC[+-]OM origin mode
DEC[+-]AWM wraparound mode
DEC[+-]ARM auto-repeat mode

Term Sorted

./ |sed 's/.*/*  (.*)  *//1/g'|sort -u|grep ^[a-zA-Z]|sortwc|grep -v ^static|sort -d|tr " " ','|sed 's/([^,]{1,}),/1,/g'

AB,ac,acs_btee,acsc,acs_chars,acs_hline,acs_llcorner,acs_lrcorner,acs_ltee,acs_plus,acs_rtee,acs_ttee,acs_ulcorner,acs_urcorner,acs_vline,ae,AF,al,AL,alt_scancode_esc,am,apstr,arrow_key_map,as,auto_left_margin,auto_right_margin,back_color_erase,backspace_delay,backspace_if_not_bs,backspaces_with_bs,back_tab,batt1,batt2,bc,bce,bel,bell,bicr,binel,birep,bit_image_carriage_return,bit_image_entwining,bit_image_newline,bit_image_repeat,bit_image_type,bitwin,bitype,bl,blink,bold,box1,box2,box_chars_1,bs,bt,BT,btml,btns,buffer_capacity,bufsz,buttons,bw,bx,can_change,carriage_return,carriage_return_delay,cb,cbt,cc,CC,ccc,cd,ce,ceol_standout_glitch,ch,change_char_pitch,change_line_pitch,change_res_horz,change_res_vert,change_scroll_region,char_padding,char_set_names,chr,chts,ci,civis,cl,clear,clear_all_tabs,clear_margins,clear_screen,clr_bol,clr_eol,clr_eos,cm,CM,cmdch,cnorm,co,Co,code_set_init,col_addr_glitch,colb0,colb1,colb2,colb3,colb4,colb5,colb6,colb7,colf0,colf1,colf2,colf3,colf4,colf5,colf6,colf7,color_names,colornm,colors,cols,column_address,columns,command_character,cpi,cpi_changes_res,cpix,cps,cr,cr_cancels_micro_mode,create_window,crt_no_scrolling,crxm,cs,csin,csnm,csr,ct,cub,cub1,cud,cud1,cuf,cuf1,cup,cursor_address,cursor_down,cursor_home,cursor_invisible,cursor_left,cursor_mem_address,cursor_normal,cursor_right,cursor_to_ll,cursor_up,cursor_visible,cuu,cuu1,cv,cvr,cvvis,CW,cwin,da,daisy,db,dB,dc,dC,DC,dch,dch1,dclk,defbi,defc,define_bit_image_region,define_char,delete_character,delete_line,dest_tabs_magic_smso,device_type,devt,DI,dial,dial_phone,dim,dispc,display_clock,display_pc_char,dis_status_line,DK,dl,DL,dl1,dm,dN,do,DO,docr,dot_horz_spacing,dot_vert_spacing,down_half_line,ds,dsl,dT,dv,eA,eat_newline_glitch,ec,ech,ed,ehhlm,ei,el,el1,elhlm,elohlm,ena_acs,enacs,endbi,end_bit_image_region,enter_alt_charset_mode,enter_am_mode,enter_blink_mode,enter_bold_mode,enter_ca_mode,enter_delete_mode,enter_dim_mode,enter_doublewide_mode,enter_draft_quality,enter_horizontal_hl_mode,enter_insert_mode,enter_italics_mode,enter_left_hl_mode,enter_leftward_mode,enter_low_hl_mode,enter_micro_mode,enter_near_letter_quality,enter_normal_quality,enter_pc_charset_mode,enter_protected_mode,enter_reverse_mode,enter_right_hl_mode,enter_scancode_mode,enter_secure_mode,enter_shadow_mode,enter_standout_mode,enter_subscript_mode,enter_superscript_mode,enter_top_hl_mode,enter_underline_mode,enter_upward_mode,enter_vertical_hl_mode,enter_xon_mode,eo,erase_chars,erase_overstrike,erhlm,es,eslok,ethlm,evhlm,exit_alt_charset_mode,exit_am_mode,exit_attribute_mode,exit_ca_mode,exit_delete_mode,exit_doublewide_mode,exit_insert_mode,exit_italics_mode,exit_leftward_mode,exit_micro_mode,exit_pc_charset_mode,exit_scancode_mode,exit_shadow_mode,exit_standout_mode,exit_subscript_mode,exit_superscript_mode,exit_underline_mode,exit_upward_mode,exit_xon_mode,F1,F2,F3,F4,F5,F6,F7,F8,F9,Fa,FA,Fb,FB,Fc,FC,Fd,FD,Fe,FE,ff,Ff,FF,Fg,FG,fh,Fh,FH,Fi,FI,fixed_pause,Fj,FJ,Fk,FK,Fl,FL,flash,flash_hook,flash_screen,fln,Fm,FM,Fn,FN,Fo,FO,font0,font1,font2,font3,font4,font5,font6,font7,form_feed,Fp,FP,Fq,FQ,Fr,FR,from_status_line,fs,FS,fsl,FT,FU,FV,FW,FX,FY,FZ,G1,G2,G3,G4,GC,GD,generic_type,getm,get_mouse,GH,GL,Gm,gn,gnu_has_meta_key,goto_window,GR,GU,GV,hangup,hard_copy,hard_cursor,has_hardware_tabs,has_meta_key,has_print_wheel,has_status_line,hc,HC,hd,hl,hls,ho,home,hook,horizontal_tab_delay,hpa,hs,ht,hts,hu,HU,hue_lightness_saturation,hup,hz,i1,i2,i3,ic,Ic,IC,ich,ich1,if,il,il1,im,in,ind,indn,init_1string,init_2string,init_3string,initc,init_file,initialize_color,initial ize_pair,initp,init_prog,init_tabs,insert_character,insert_line,insert_null_glitch,insert_padding,invis,ip,iP,Ip,iprog,is,is1,is2,is3,it,k;,k0,k1,K1,k2,K2,k3,K3,k4,K4,k5,K5,k6,k7,k8,k9,ka,kA,ka1,ka3,kact,kb,kB,kb2,kbeg,kBEG,kbs,kbtab,kC,kc1,kc3,kcan,kCAN,kcbt,kclo,kclr,kcmd,kCMD,kcpn,kcpy,kCPY,kcrt,kCRT,kctab,kcub1,kcud1,kcuf1,kcuu1,kd,kD,kDC,kdch1,kDL,kdl1,kdo,ke,kE,ked,kel,kend,kEND,kent,kEOL,kext,kEXT,key_a1,key_a3,key_b2,key_backspace,key_beg,key_btab,key_c1,key_c3,key_cancel,key_catab,key_clear,key_close,key_command,key_copy,key_create,key_ctab,key_dc,key_dl,key_down,key_eic,key_end,key_enter,key_eol,key_eos,key_exit,key_f0,key_f1,key_f10,key_f11,key_f12,key_f13,key_f14,key_f15,key_f16,key_f17,key_f18,key_f19,key_f2,key_f20,key_f21,key_f22,key_f23,key_f24,key_f25,key_f26,key_f27,key_f28,key_f29,key_f3,key_f30,key_f31,key_f32,key_f33,key_f34,key_f35,key_f36,key_f37,key_f38,key_f39,key_f4,key_f40,key_f41,key_f42,key_f43,key_f44,key_f45,key_f46,key_f47,key_f48,key_f49,key_f5,key_f50,key_f51,key_f52,key_f53,key_f54,key_f55,key_f56,key_f57,key_f58,key_f59,key_f6,key_f60,key_f61,key_f62,key_f63,key_f7,key_f8,key_f9,key_find,key_help,key_home,key_ic,key_il,key_left,key_ll,key_mark,key_message,key_mouse,key_move,key_next,key_npage,key_open,key_options,keypad_local,keypad_xmit,key_ppage,key_previous,key_print,key_redo,key_reference,key_refresh,key_replace,key_restart,key_resume,key_right,key_save,key_sbeg,key_scancel,key_scommand,key_scopy,key_screate,key_sdc,key_sdl,key_select,key_send,key_seol,key_sexit,key_sf,key_sfind,key_shelp,key_shome,key_sic,key_sleft,key_smessage,key_smove,key_snext,key_soptions,key_sprevious,key_sprint,key_sr,key_sredo,key_sreplace,key_sright,key_srsume,key_ssave,key_ssuspend,key_stab,key_sundo,key_suspend,key_undo,key_up,kF,kf0,kf1,kf10,kf11,kf12,kf13,kf14,kf15,kf16,kf17,kf18,kf19,kf2,kf20,kf21,kf22,kf23,kf24,kf25,kf26,kf27,kf28,kf29,kf3,kf30,kf31,kf32,kf33,kf34,kf35,kf36,kf37,kf38,kf39,kf4,kf40,kf41,kf42,kf43,kf44,kf45,kf46,kf47,kf48,kf49,kf5,kf50,kf51,kf52,kf53,kf54,kf55,kf56,kf57,kf58,kf59,kf6,kf60,kf61,kf62,kf63,kf7,kf8,kf9,kfnd,kFND,kh,kH,khlp,kHLP,kHOM,khome,khts,kI,kIC,kich1,kil1,kind,kl,kL,kLFT,kll,km,kM,Km,kmous,kmov,kMOV,kmpf1,kmpf2,kmpf3,kmpf4,kmpf5,kmpf6,kmpf7,kmpf8,kmpf9,kmpt1,kmpt2,kmpt3,kmpt4,kmpt5,kmpt6,kmpt7,kmpt8,kmpt9,kmrk,kmsg,kMSG,kn,kN,knl,knp,knpn,knxt,kNXT,ko,kopn,kopt,kOPT,kP,kpp,kppn,kprt,kPRT,kprv,kPRV,kquit,kr,kR,krdo,kRDO,kref,kres,kRES,krfr,kri,kRIT,krmir,krpl,kRPL,krst,ks,kS,ksav,kSAV,kscl,kscr,ksel,ksf1,ksf10,ksf2,ksf3,ksf4,ksf5,ksf6,ksf7,ksf8,ksf9,kslt,kspd,kSPD,kt,kT,ktab,ktbc,ku,kund,kUND,l0,l1,l2,l3,l4,l5,l6,l7,l8,l9,la,label_format,label_height,label_off,label_on,label_width,lab_f0,lab_f1,lab_f10,lab_f2,lab_f3,lab_f4,lab_f5,lab_f6,lab_f7,lab_f8,lab_f9,le,LE,Lf,LF,lf0,lf1,lf10,lf2,lf3,lf4,lf5,lf6,lf7,lf8,lf9,lh,li,linefeed_if_not_lf,linefeed_is_newline,lines,lines_of_memory,ll,lm,LO,lpi,lpi_changes_res,lpix,lvert,lw,ma,maddr,magic_cookie_glitch,magic_cookie_glitch_ul,max_attributes,max_colors,maximum_windows,max_micro_address,max_micro_jump,max_pairs,mb,MC,mc0,mc4,mc5,mc5i,mc5p,mcs,mcub,mcub1,mcud,mcud1,mcuf,mcuf1,mcuu,mcuu1,md,me,meml,memory_above,memory_below,memory_lock,memory_unlock,memu,meta_off,meta_on,mgc,mh,mhpa,mi,Mi,micro_col_size,micro_column_address,micro_down,micro_left,micro_line_size,micro_right,micro_row_address,micro_up,minfo,mir,mjump,mk,ml,ML,mls,mm,mo,mouse_info,move_insert_mode,move_standout_mode,mp,mr,MR,mrcup,ms,msgr,MT,mu,mvpa,MW,nc,NC,ncv,nd,ND,ndscr,needs_xon_xoff,nel,newline,new_line_delay,nl,Nl,NL,nlab,no_color_video,no_correctly_working_cr,no_esc_ctlc,non_dest_scroll_region,non_rev_rmcup,no_pad_char,NP,npc,npins,NR,nrrmc,ns,number_of_function_keys,number_of_pins,num_labels,nw,nx,nxon,oc,op,orc,order_of_pins,orhi,orig_colors,orig_pair,orl,orvi,os,OTbc,OTbs,OTdB,OTdC,OTdN,OTdT,OTG1,OTG2,OTG3,OTG4,OTGC,OTGD,OTGH,OTGL,OTGR,OTGU,OTGV,other_non_function_keys,OTi2,OTkn,OTko,OTma,OTMT,OTnc,OTnl,OTNL,OTns,OTpt,OTrs,OTug,OTxr,output_res_char,output_res_horz_inch,output_res_line,output_res_vert_inch,over_strike,pa,PA,pad,pad_char,padding_baud_rate,pairs,parm_dch,parm_delete_line,parm_down_cursor,parm_down_micro,parm_ich,parm_index,parm_insert_line,parm_left_cursor,parm_left_micro,parm_right_cursor,parm_right_micro,parm_rindex,parm_up_cursor,parm_up_micro,pause,pb,pc,pc_term_options,pctrm,pf,pfkey,pfloc,pfx,pfxl,pk,pkey_key,pkey_local,pkey_plab,pkey_xmit,pl,plab_norm,pln,pn,po,pO,porder,print_rate,print_screen,prot,prtr_non,prtr_off,prtr_on,prtr_silent,ps,pt,PU,pulse,px,QD,qdial,quick_dial,r1,r2,r3,RA,rbim,rc,RC,rcsd,remove_clock,rep,repeat_char,req_for_input,req_mouse_pos,reqmp,reset_1string,reset_2string,reset_3string,reset_file,restore_cursor,return_does_clr_eol,rev,rf,RF,rfi,ri,RI,rin,ritm,rlm,rmacs,rmam,rmclk,rmcup,rmdc,rmicm,rmir,rmkx,rmln,rmm,rmp,rmpch,rmsc,rmso,rmul,rmxon,row_address,row_addr_glitch,rp,rP,RQ,rs,rs1,rs2,rs3,rshm,rsubm,rsupm,rum,rvert,rwidm,RX,s0,s0ds,s1,S1,s1ds,s2,S2,s2ds,s3,S3,s3ds,S4,S5,S6,S7,S8,sa,sA,SA,sam,save_cursor,Sb,sbim,sc,SC,scancode_escape,scesa,scesc,sclk,scp,scroll_forward,scroll_reverse,scs,scsd,sdrfq,se,select_char_set,semi_auto_right_margin,set0_des_seq,set1_des_seq,set2_des_seq,set3_des_seq,set_a_attributes,setab,set_a_background,setaf,set_a_foreground,set_attributes,setb,set_background,set_bottom_margin,set_bottom_margin_parm,set_clock,setcolor,set_color_band,set_color_pair,setf,set_foreground,set_left_margin,set_left_margin_parm,set_lr_margin,set_page_length,set_pglen_inch,set_right_margin,set_right_margin_parm,set_tab,set_tb_margin,set_top_margin,set_top_margin_parm,set_window,sf,Sf,SF,sg,sgr,sgr0,sgr1,sitm,sL,slength,slines,slm,smacs,smam,smcup,smdc,smgb,smgbp,smgl,smglp,smglr,smgr,smgrp,smgt,smgtb,smgtp,smicm,smir,smkx,smln,smm,smpch,smsc,smso,smul,smxon,snlq,snrmq,so,sp,spinh,spinv,sr,SR,sshm,ssubm,ssupm,st,start_bit_image,start_char_set_def,status_line_esc_ok,stop_bit_image,stop_char_set_def,subcs,subscript_characters,sum,supcs,superscript_characters,swidm,SX,ta,tab,tbc,te,termcap_init2,termcap_reset,these_cause_cr,ti,tilde_glitch,TO,tone,topl,to_status_line,transparent_underline,ts,tsl,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,uc,ue,ug,ul,underline_char,up,UP,up_half_line,us,user0,user1,user2,user3,user4,user5,user6,user7,user8,user9,ut,vb,ve,vi,virtual_terminal,vpa,vs,vt,WA,wait,wait_tone,WG,wi,widcs,wide_char_size,width_status_line,wind,wingo,wnum,ws,wsl,xb,xenl,XF,Xh,xhp,xhpa,xl,Xl,xmc,xn,XN,xo,Xo,xoffc,xoff_character,xon,xonc,xon_character,xon_xoff,xr,Xr,xs,xsb,xt,Xt,Xv,xvpa,Xy,Ya,YA,Yb,YB,Yc,YC,Yd,YD,Ye,YE,Yf,YF,Yg,YG,Yh,Yi,Yj,Yk,Yl,Ym,Yn,Yo,Yp,Yv,Yw,Yx,Yy,Yz,YZ,Za,ZA,Zb,ZB,Zc,ZC,Zd,ZD,Ze,ZE,zerom,zero_motion,Zf,ZF,Zg,ZG,Zh,ZH,Zi,ZI,Zj,ZJ,Zk,ZK,Zl,ZL,Zm,ZM,Zn,ZN,Zo,ZO,Zp,ZP,Zq,ZQ,Zr,ZR,Zs,ZS,Zt,ZT,Zu,ZU,Zv,ZV,Zw,ZW,Zx,ZX,Zy,ZY,Zz,ZZ


ANSI.SYS/ISO 6429/ECMA-48 Capabilities
ANSI/ECMA-48 terminals and terminal emulators
DOS ANSI.SYS variants
ANSI console types
Linux consoles
OSF Unix
NetBSD consoles
FreeBSD console entries
386BSD and BSD/OS Consoles
DEC VT100 and compatibles
VT100 emulations
X terminal emulators
Pilot Pro Palm-Top
Alpha consoles
Sun consoles
Iris consoles
NeWS consoles
NeXT consoles
Sony NEWS workstations
Common Desktop Environment
Non-Unix Consoles
Hewlett-Packard (hp)
Lear-Siegler (adm)
Qume (qvt)
Televideo (tvi)
Visual (vi)
Wyse (wy)
Kermit terminal emulations
Matrix Orbital
AT&T (att, tty)
Ampex (Dialogue)
Ann Arbor (aa)
Applied Digital Data Systems (adds)
C. Itoh Electronics
Control Data (cdc)
Human Designed Systems (Concept)
Contel Business Systems.
Data General (dg)
Datamedia (dm)

Just something sorta cool for you to check out

 local t=`tputm 'clear' 'setaf 75'` l a b f=/tmp/ps IFS=' ';
exec 6<>$f;ps L|tr -s ' ' &>$f;
while read -u6 l;do a=${l/% */} b=${l/* /};
figlet -rtw $((${COLUMNS} /2 )) -f big "$l";
tput sgr0;
command ps wwo pid:6,user:8,vsize:8,comm:20,$a:50 k -$a -A;cont;
  1. Colors and formatting (ANSI/VT100 Control sequences)

Linux ANSI escape code ANSI.SYS Control characters Escape sequence Stty Termcap Terminfo Tput