termcap - Man Page

terminal capability database

Description

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 4.3BSD 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.

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

5iPrinter will not echo on screen
amAutomatic margins which means automatic line wrap
bsControl-H (8 dec.) performs a backspace
bwBackspace on left margin wraps to previous line and right margin
daDisplay retained above screen
dbDisplay retained below screen
eoA space erases all characters at cursor position
esEscape sequences and special characters work in status line
gnGeneric device
hcThis is a hardcopy terminal
HCThe cursor is hard to see when not on bottom line
hsHas a status line
hzHazeltine bug, the terminal can not print tilde characters
inTerminal inserts null bytes, not spaces, to fill whitespace
kmTerminal has a meta key
miCursor movement works in insert mode
msCursor movement works in standout/underline mode
NPNo pad character
NRti does not reverse te
nxNo padding, must use XON/XOFF
osTerminal can overstrike
ulTerminal underlines although it can not overstrike
xbBeehive glitch, f1 sends ESCAPE, f2 sends ^C
xnNewline/wraparound glitch
xoTerminal uses xon/xoff protocol
xsText typed over standout text will be displayed in standout
xtTeleray glitch, destructive tabs and odd standout mode

Numeric capabilities

coNumber of columns
dBDelay in milliseconds for backspace on hardcopy terminals
dCDelay in milliseconds for carriage return on hardcopy terminals
dFDelay in milliseconds for form feed on hardcopy terminals
dNDelay in milliseconds for new line on hardcopy terminals
dTDelay in milliseconds for tabulator stop on hardcopy terminals
dVDelay in milliseconds for vertical tabulator stop on
hardcopy terminals
itDifference between tab positions
lhHeight of soft labels
lmLines of memory
lwWidth of soft labels
liNumber of lines
NlNumber of soft labels
pbLowest baud rate which needs padding
sgStandout glitch
ugUnderline glitch
vtvirtual terminal number
wsWidth of status line if different from screen width

String capabilities

!1shifted save key
!2shifted suspend key
!3shifted undo key
#1shifted help key
#2shifted home key
#3shifted input key
#4shifted cursor left key
%0redo key
%1help key
%2mark key
%3message key
%4move key
%5next-object key
%6open key
%7options key
%8previous-object key
%9print key
%ashifted message key
%bshifted move key
%cshifted next key
%dshifted options key
%eshifted previous key
%fshifted print key
%gshifted redo key
%hshifted replace key
%ishifted cursor right key
%jshifted resume key
&0shifted cancel key
&1reference key
&2refresh key
&3replace key
&4restart key
&5resume key
&6save key
&7suspend key
&8undo key
&9shifted begin key
*0shifted find key
*1shifted command key
*2shifted copy key
*3shifted create key
*4shifted delete character
*5shifted delete line
*6select key
*7shifted end key
*8shifted clear line key
*9shifted exit key
@0find key
@1begin key
@2cancel key
@3close key
@4command key
@5copy key
@6create key
@7end key
@8enter/send key
@9exit key
alInsert one line
ALInsert %1 lines
acPairs of block graphic characters to map alternate character set
aeEnd alternative character set
asStart alternative character set for block graphic characters
bcBackspace, if not ^H
blAudio bell
btMove to previous tab stop
cbClear from beginning of line to cursor
ccDummy command character
cdClear to end of screen
ceClear to end of line
chMove cursor horizontally only to column %1
clClear screen and cursor home
cmCursor move to row %1 and column %2 (on screen)
CMMove cursor to row %1 and column %2 (in memory)
crCarriage return
csScroll region from line %1 to %2
ctClear tabs
cvMove cursor vertically only to line %1
dcDelete one character
DCDelete %1 characters
dlDelete one line
DLDelete %1 lines
dmBegin delete mode
doCursor down one line
DOCursor down #1 lines
dsDisable status line
eAEnable alternate character set
ecErase %1 characters starting at cursor
edEnd delete mode
eiEnd insert mode
ffFormfeed character on hardcopy terminals
fsReturn character to its position before going to status line
F1The string sent by function key f11
F2The string sent by function key f12
F3The string sent by function key f13
......
F9The string sent by function key f19
FAThe string sent by function key f20
FBThe string sent by function key f21
......
FZThe string sent by function key f45
FaThe string sent by function key f46
FbThe string sent by function key f47
......
FrThe string sent by function key f63
hdMove cursor a half line down
hoCursor home
huMove cursor a half line up
i1Initialization string 1 at login
i3Initialization string 3 at login
isInitialization string 2 at login
icInsert one character
ICInsert %1 characters
ifInitialization file
imBegin insert mode
ipInsert pad time and needed special characters after insert
iPInitialization program
K1upper left key on keypad
K2center key on keypad
K3upper right key on keypad
K4bottom left key on keypad
K5bottom right key on keypad
k0Function key 0
k1Function key 1
k2Function key 2
k3Function key 3
k4Function key 4
k5Function key 5
k6Function key 6
k7Function key 7
k8Function key 8
k9Function key 9
k;Function key 10
kaClear all tabs key
kAInsert line key
kbBackspace key
kBBack tab stop
kCClear screen key
kdCursor down key
kDKey for delete character under cursor
keturn keypad off
kEKey for clear to end of line
kFKey for scrolling forward/down
khCursor home key
kHCursor hown down key
kIInsert character/Insert mode key
klCursor left key
kLKey for delete line
kMKey for exit insert mode
kNKey for next page
kPKey for previous page
krCursor right key
kRKey for scrolling backward/up
ksTurn keypad on
kSClear to end of screen key
ktClear this tab key
kTSet tab here key
kuCursor up key
l0Label of zeroth function key, if not f0
l1Label of first function key, if not f1
l2Label of first function key, if not f2
......
laLabel of tenth function key, if not f10
leCursor left one character
llMove cursor to lower left corner
LECursor left %1 characters
LFTurn soft labels off
LOTurn soft labels on
mbStart blinking
MCClear soft margins
mdStart bold mode
meEnd all mode like so, us, mb, md, and mr
mhStart half bright mode
mkDark mode (Characters invisible)
MLSet left soft margin
mmPut terminal in meta mode
moPut terminal out of meta mode
mpTurn on protected attribute
mrStart reverse mode
MRSet right soft margin
ndCursor right one character
nwCarriage return command
pcPadding character
pfTurn printer off
pkProgram key %1 to send string %2 as if typed by user
plProgram key %1 to execute string %2 in local mode
pnProgram soft label %1 to show string %2
poTurn the printer on
pOTurn the printer on for %1 (<256) bytes
psPrint screen contents on printer
pxProgram key %1 to send string %2 to computer
r1Reset string 1 to set terminal to sane modes
r2Reset string 2 to set terminal to sane modes
r3Reset string 3 to set terminal to sane modes
RAdisable automatic margins
rcRestore saved cursor position
rfReset string filename
RFRequest for input from terminal
RICursor right %1 characters
rpRepeat character %1 for %2 times
rPPadding after character sent in replace mode
rsReset string
RXTurn off XON/XOFF flow control
saSet %1 %2 %3 %4 %5 %6 %7 %8 %9 attributes
SAenable automatic margins
scSave cursor position
seEnd standout mode
sfNormal scroll one line
SFNormal scroll %1 lines
soStart standout mode
srReverse scroll
SRscroll back %1 lines
stSet tabulator stop in all rows at current column
SXTurn on XON/XOFF flow control
tamove to next hardware tab
tcRead in terminal description from another entry
teEnd program that uses cursor motion
tiBegin program that uses cursor motion
tsMove cursor to column %1 of status line
ucUnderline character under cursor and move cursor right
ueEnd underlining
upCursor up one line
UPCursor up %1 lines
usStart underlining
vbVisible bell
veNormal cursor visible
viCursor invisible
vsStandout cursor
wiSet window from line %1 to %2 and column %3 to %4
XFXOFF character if not ^S

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.

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 ('\0') because it terminates the string. You should reset tabulator expansion if a tabulator can be the binary output of a parameter.

Warning:

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:

as

start the alternative charset

ae

end the alternative charset

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)
0full square (#)
Ilantern (#)
-upper arrow (^)
'rhombus (+)
achess board (:)
fdegree (')
gplus-minus (#)
hsquare (#)
jright bottom corner (+)
kright upper corner (+)
lleft upper corner (+)
mleft bottom corner (+)
ncross (+)
oupper horizontal line (-)
qmiddle horizontal line (-)
sbottom horizontal line (_)
tleft tee (+)
uright tee (+)
vbottom tee (+)
wnormal tee (+)
xvertical line (|)
~paragraph (???)

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

See Also

ncurses(3), termcap(3), terminfo(5)

Referenced By

aterm(1), backgammon(6), bmore(1), editline(3), editrc(5), gtags.conf(5), ksh93(1), lynx(1), screen(1), s-nail(1), systemd.exec(5), tcsh(1), ttytype(5), urxvt(1).

2024-06-15 Linux man-pages 6.9.1