termcap - terminal capability database


The termcap database is an obsolete facility for describing the capabilities of character-cell terminals and printers. It is retained only for capability with old programs; new ones 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 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.

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 prior) 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 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

5i Printer will not echo on screen am Automatic margins which means automatic line wrap bs Control-H (8 dec.) performs a backspace bw Backspace on left margin wraps to previous line and right margin da Display retained above screen db Display retained below screen eo A space erases all characters at cursor position es Escape sequences and special characters work in status line gn Generic device hc This is a hardcopy terminal HC The cursor is hard to see when not on bottom line hs Has a status line hz Hazeltine bug, the terminal can not print tilde characters in Terminal inserts nulls, not spaces, to fill whitespace km Terminal has a meta key mi Cursor movement works in insert mode ms Cursor movement works in standout/underline mode NP No pad character NR ti does not reverse te nx No padding, must use XON/XOFF os Terminal can overstrike ul Terminal underlines although it can not overstrike xb Beehive glitch, f1 sends ESCAPE, f2 sends ^C xn Newline/wraparound glitch xo Terminal uses xon/xoff protocol xs Text typed over standout text will be displayed in standout xt Teleray glitch, destructive tabs and odd standout mode

Numeric Capabilities

co Number of columns dB Delay in milliseconds for backspace on hardcopy terminals dC Delay in milliseconds for carriage return on hardcopy terminals dF Delay in milliseconds for form feed on hardcopy terminals dN Delay in milliseconds for new line on hardcopy terminals dT Delay in milliseconds for tabulator stop on hardcopy terminals dV Delay in milliseconds for vertical tabulator stop on hardcopy terminals it Difference between tab positions lh Height of soft labels lm Lines of memory lw Width of soft labels li Number of lines Nl Number of soft labels pb Lowest baud rate which needs padding sg Standout glitch ug Underline glitch vt virtual terminal number ws Width of status line if different from screen width

String Capabilities

1 shifted save key

2 shifted suspend key

3 shifted undo key

  1. 1 shifted help key
  2. 2 shifted home key
  3. 3 shifted input key
  4. 4 shifted cursor left key

%0 redo key %1 help key %2 mark key %3 message key %4 move key %5 next-object key %6 open key %7 options key %8 previous-object key %9 print key %a shifted message key %b shifted move key %c shifted next key %d shifted options key %e shifted previous key %f shifted print key %g shifted redo key %h shifted replace key %i shifted cusor right key %j shifted resume key There are several ways of defining the control codes for string capabilities:

Normal Characters except '^','' and '%' repesent themself.

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

x means a special code. x can be one of the following charaters:

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 paramters 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 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 grafic characters can be specified by three string capabilities:


start the alternative charset


end it


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

The following names are available:

  • right arrow (

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


termcap(3)?, curses(3)?, terminfo(5)

This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.