TERMCAP(5)

NAME
termcap - terminal capability database

DESCRIPTION
/etc/termcap is an ASCII file that lists the capabilities of many different types of terminal. Programs can read termcap to find the particular escape codes needed to control the visual attributes of the terminal actually in use. (Other aspects of the terminal are handled by stty.) The termcap database is indexed on the TERM environment variable, which is set by login to the default of `Minix', and which can be reset by the program tset.

Termcap entries must be defined on a single logical line, with `\' used to suppress the newline. Fields are separated by `:'. The first field of each entry starts at the left-hand margin, and contain a list of names for the terminal, separated by '|'. The first subfield contains a short name consisting of two characters. It is a relict of system V6, where a system wide database of 16 bit (equals these two characters) per terminal existed. This name can consist of capital or small letters. The second subfield contains the name used by the environment variable TERM. It should be spelled in lowercase letters. Selectable hardware capabilities should be marked by appending a hyphen and a suffix to this name. See below for an example. Usual suffixes are w (more than 80 characters), am (automatic margins), nam (no automatic margins) and rv (reverse video display). The third subfield contains a long and descriptive name for this termcap entry.

Subsequent fields contain the terminal capabilities; any continued capability lines must be indented one tab from the left margin.

Although there is no defined order, it is suggested to write first boolean, then numeric and at last string capabilities, each sorted alphabetically without looking at lower or upper spelling. Capabilities of similar functions can be written in one line.

Example for:

Head line: vt|vt101|DEC VT 101 terminal in 80 character mode:\
Head line: Vt|vt101-w|DEC VT 101 terminal in (wide) 132 character mode:\
Boolean: :bs:\
Numeric: :co#80:\
String: :sr=\E[H:\

  Boolean Capabilities
    am	Automatic margins which means automatic line wrap
    bs	Control-H (8 dec.) performs a backspace
    gn	Generic device
    hs	Has status line
    hz	Hazeltine can't print tilde
    mi	Can be set to insert mode
    ms	Can be set to standout mode
    xi	Terminal uses xon/xoff protocol

  Numeric Capabilities
    co	Number of columns
    li	Number of lines
    it	Difference between tab positions
    pb	Lowest baud rate which needs padding
    sg	Standout glitch
    ug	Underline glitch

  String Capabilities
    @1	begin key
    @2	cancel key
    @3	close key
    @4	command key
    @5	copy key
    @6	create key
    @7	end key
    @8	enter key
    @9	exit key
    al	Insert one line
    AL	Insert #1 lines
    ac	Pairs of block graphic characters
    ae	End alternative character set
    as	Start alternative character set for block graphic characters
    bl	Bell
    cd	Clear to end of screen
    ce	Clear to end of line
    cl	Clear screen and cursor home
    cm	Cursor move to #1 #2
    cr	Carriage return
    cs	Scroll region from line #1 to #2
    ct	Clear tabs
    dc	Delete one character
    DC	Delete #1 characters
    dl	Delete one line
    DL	Delete #1 lines
    do	Cursor down one line
    DO	Cursor down #1 lines
    ds	Disable status line
    ei	End insert mode
    ho	Cursor home
    K1	upper left key on keypad
    K2	center key on keypad
    K3	upper right key on keypad
    K4	bottom left key on keypad
    K5	bottom right key on keypad
    k0	Function key 0
    k1	Function key 1
    k2	Function key 2
    k3	Function key 3
    k4	Function key 4
    k5	Function key 5
    k6	Function key 6
    k7	Function key 7
    k8	Function key 8
    k9	Function key 9
    k;	Function key 10
    kb	Backspace key
    kB	Back tab stop
    kd	Cursor down key
    kD	Key for delete character under cursor
    ke\numeric keypad
    kE	Key for clear to end of line
    kh	Cursor home key
    kl	Cursor left key
    kL	Key for delete line
    kN	Key for next page
    kP	Key for previous page
    kr	Cursor right key
    ks	application keypad
    ku	Cursor up key
    ic	Insert one character
    IC	Insert #1 characters
    im	Switch to insert mode
    le	Cursor left one character
    LE	Cursor left #1 characters
    mb	Start blinking
    md	Start bold mode
    me	End all mode like so, us, mb, md and mr
    mh	Start half bright mode
    mk	Dark mode (Characters invisible)
    mr	Start reverse mode
    nd	Cursor right one character
    pc	Padding character
    RA	disable automatic margins
    rc	Restore saved cursor position
    RI	Cursor right #1 characters
    SA	enable automatic margins
    sc	Save cursor position
    se	End standout mode
    sf	Normal scroll
    so	Start standout mode
    sr	Reverse scroll
    SR	scroll back #1 lines
    ta	tab to next 8 character hardware tab
    ue	End underlining
    up	Cursor up one line
    UP	Cursor up #1 lines
    us	Start underlining
    vb	Visible bell
    ve	Normal cursor visible
    vi	Cursor invisible
    vs	Standout cursor
    wi	Set window from line #1 to #2 and column #3 to #4

There are several ways of defining the control codes for string capabilities:

Normal Characters except '^','\' and '%' represent themselves.

A '^x' means Control-x. Control-A equals 1 decimal.

\x means a special code. x can be one of the following characters:
    E Escape (27)
    n Line feed (10)
    r Carriage return (13)
    t Tabulation (9)
    b Backspace (8)
    f Form feed (12)
    0 Null character. A \xxx specifies the octal character xxx.

i   Increments parameters by one.

r   Single parameter capability

+   Add value of next character to this parameter and do binary output

2   Do ASCII output of this parameter with a field with of 2

d   Do ASCII output of this parameter with a field with of 3

%   Print a '%'

If you use binary output, then you should avoid the null character because it terminates the string. You should reset tabulator expansion if a tabulator can be the binary output of a parameter.

Warning:
    The above meta-characters for parameters may be wrong, they document Minix termcap which may not be compatible with Linux termcap.

The block graphic characters can be specified by three string capabilities:

as  start the alternative charset

ae  end it

ac  pairs of characters. The first character is the name of the block graphic symbol and the second characters is its definition.

The following names are available:

+	right arrow (>)
,	left arrow (<)
.	down arrow (v)
0	full square (#)
I	latern (#)
-	upper arrow (^)
'	rhombus (+)
a	chess board (:)
f	degree (')
g	plus-minus (#)
h	square (#)
j	right bottom corner (+)
k	right upper corner (+)
l	left upper corner (+)
m	left bottom corner (+)
n	cross (+)
o	upper horizontal line (-)
q	middle horizontal line (-)
s	bottom horizontal line (_)
t	left tee (+)
u	right tee (+)
v	bottom tee (+)
w	normal tee (+)
x	vertical line (|)
~	paragraph (???)

The values in parentheses are suggested defaults which are used by curses, if the capabilities are missing.

SEE ALSO
termcap(3)