The termcap database is an obsolete facility for describing the capabilities of character-cell terminals and printers. It is retained only for compatibility with old programs; new programs should use the terminfo(5) database and associated libraries.
/etc/termcap is an ASCII file (the database master) that lists the capabilities of many different types of terminals. 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(1).) The termcap database is indexed on the TERM environment variable.
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 contains a list of names for the terminal, separated by '|'.
The first subfield may (in BSD termcap entries from versions 4.3 and earlier) contain a short name consisting of two characters. This short name may consist of capital or small letters. In 4.4BSD, termcap entries this field is omitted.
The second subfield (first, in the newer 4.4BSD format) 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 wide), 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 then string capabilities, each sorted alphabetically without looking at lower or upper spelling. Capabilities of similar functions can be written in one line.
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:\
There are several ways of defining the control codes for string capabilities:
Every normal character represents itself, except '^', '\', and '%'.
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 Linefeed (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.
Increments parameters by one.
Single parameter capability
Add value of next character to this parameter and do binary output
Do ASCII output of this parameter with a field with of 2
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 ('\0') because it terminates the string. You should reset tabulator expansion if a tabulator can be the binary output of a parameter.
The above metacharacters 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:
start the alternative charset
end the alternative charset
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:
The values in parentheses are suggested defaults which are used by the curses library, if the capabilities are missing.
ncurses(3), termcap(3), terminfo(5)
This page is part of release 5.08 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
aterm(1), backgammon(6), bmore(1), editline(3), editrc(5), gtags.conf(5), lynx(1), screen(1), s-nail(1), systemd.exec(5), tcsh(1), ttytype(5), urxvt(1).