Home

termcap(5)

termcap(5)File Formats Manualtermcap(5)

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 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:\

5i	Printer will not echo on screenam	Automatic margins which means automatic line wrapbs	Control-H (8 dec.) performs a backspacebw	Backspace on left margin wraps to previous line and right marginda	Display retained above screendb	Display retained below screeneo	A space erases all characters at cursor positiones	Escape sequences and special characters work in status linegn	Generic devicehc	This is a hardcopy terminalHC	The cursor is hard to see when not on bottom linehs	Has a status linehz	Hazeltine bug, the terminal can not print tilde charactersin	Terminal inserts null bytes, not spaces, to fill whitespacekm	Terminal has a meta keymi	Cursor movement works in insert modems	Cursor movement works in standout/underline modeNP	No pad characterNR	ti does not reverse tenx	No padding, must use XON/XOFFos	Terminal can overstrikeul	Terminal underlines although it can not overstrikexb	Beehive glitch, f1 sends ESCAPE, f2 sends ^Cxn	Newline/wraparound glitchxo	Terminal uses xon/xoff protocolxs	Text typed over standout text will be displayed in standoutxt	Teleray glitch, destructive tabs and odd standout mode

co	Number of columnsdB	Delay in milliseconds for backspace on hardcopy terminalsdC	Delay in milliseconds for carriage return on hardcopy terminalsdF	Delay in milliseconds for form feed on hardcopy terminalsdN	Delay in milliseconds for new line on hardcopy terminalsdT	Delay in milliseconds for tabulator stop on hardcopy terminalsdV	Delay in milliseconds for vertical tabulator stop on	hardcopy terminalsit	Difference between tab positionslh	Height of soft labelslm	Lines of memorylw	Width of soft labelsli	Number of linesNl	Number of soft labelspb	Lowest baud rate which needs paddingsg	Standout glitchug	Underline glitchvt	virtual terminal numberws	Width of status line if different from screen width

!1	shifted save key!2	shifted suspend key!3	shifted undo key#1	shifted help key#2	shifted home key#3	shifted input key#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 cursor right key%j	shifted resume key&0	shifted cancel key&1	reference key&2	refresh key&3	replace key&4	restart key&5	resume key&6	save key&7	suspend key&8	undo key&9	shifted begin key*0	shifted find key*1	shifted command key*2	shifted copy key*3	shifted create key*4	shifted delete character*5	shifted delete line*6	select key*7	shifted end key*8	shifted clear line key*9	shifted exit key@0	find key@1	begin key@2	cancel key@3	close key@4	command key@5	copy key@6	create key@7	end key@8	enter/send key@9	exit keyal	Insert one lineAL	Insert %1 linesac	Pairs of block graphic characters to map alternate character setae	End alternative character setas	Start alternative character set for block graphic charactersbc	Backspace, if not ^Hbl	Audio bellbt	Move to previous tab stopcb	Clear from beginning of line to cursorcc	Dummy command charactercd	Clear to end of screence	Clear to end of linech	Move cursor horizontally only to column %1cl	Clear screen and cursor homecm	Cursor move to row %1 and column %2 (on screen)CM	Move cursor to row %1 and column %2 (in memory)cr	Carriage returncs	Scroll region from line %1 to %2ct	Clear tabscv	Move cursor vertically only to line %1dc	Delete one characterDC	Delete %1 charactersdl	Delete one lineDL	Delete %1 linesdm	Begin delete modedo	Cursor down one lineDO	Cursor down #1 linesds	Disable status lineeA	Enable alternate character setec	Erase %1 characters starting at cursored	End delete modeei	End insert modeff	Formfeed character on hardcopy terminalsfs	Return character to its position before going to status lineF1	The string sent by function key f11F2	The string sent by function key f12F3	The string sent by function key f13...	...F9	The string sent by function key f19FA	The string sent by function key f20FB	The string sent by function key f21...	...FZ	The string sent by function key f45Fa	The string sent by function key f46Fb	The string sent by function key f47...	...Fr	The string sent by function key f63hd	Move cursor a half line downho	Cursor homehu	Move cursor a half line upi1	Initialization string 1 at logini3	Initialization string 3 at loginis	Initialization string 2 at loginic	Insert one characterIC	Insert %1 charactersif	Initialization fileim	Begin insert modeip	Insert pad time and needed special characters after insertiP	Initialization programK1	upper left key on keypadK2	center key on keypadK3	upper right key on keypadK4	bottom left key on keypadK5	bottom right key on keypadk0	Function key 0k1	Function key 1k2	Function key 2k3	Function key 3k4	Function key 4k5	Function key 5k6	Function key 6k7	Function key 7k8	Function key 8k9	Function key 9k;	Function key 10ka	Clear all tabs keykA	Insert line keykb	Backspace keykB	Back tab stopkC	Clear screen keykd	Cursor down keykD	Key for delete character under cursorke	turn keypad offkE	Key for clear to end of linekF	Key for scrolling forward/downkh	Cursor home keykH	Cursor hown down keykI	Insert character/Insert mode keykl	Cursor left keykL	Key for delete linekM	Key for exit insert modekN	Key for next pagekP	Key for previous pagekr	Cursor right keykR	Key for scrolling backward/upks	Turn keypad onkS	Clear to end of screen keykt	Clear this tab keykT	Set tab here keyku	Cursor up keyl0	Label of zeroth function key, if not f0l1	Label of first function key, if not f1l2	Label of first function key, if not f2...	...la	Label of tenth function key, if not f10le	Cursor left one characterll	Move cursor to lower left cornerLE	Cursor left %1 charactersLF	Turn soft labels offLO	Turn soft labels onmb	Start blinkingMC	Clear soft marginsmd	Start bold modeme	End all mode like so, us, mb, md, and mrmh	Start half bright modemk	Dark mode (Characters invisible)ML	Set left soft marginmm	Put terminal in meta modemo	Put terminal out of meta modemp	Turn on protected attributemr	Start reverse modeMR	Set right soft marginnd	Cursor right one characternw	Carriage return commandpc	Padding characterpf	Turn printer offpk	Program key %1 to send string %2 as if typed by userpl	Program key %1 to execute string %2 in local modepn	Program soft label %1 to show string %2po	Turn the printer onpO	Turn the printer on for %1 (<256) bytesps	Print screen contents on printerpx	Program key %1 to send string %2 to computerr1	Reset string 1 to set terminal to sane modesr2	Reset string 2 to set terminal to sane modesr3	Reset string 3 to set terminal to sane modesRA	disable automatic marginsrc	Restore saved cursor positionrf	Reset string filenameRF	Request for input from terminalRI	Cursor right %1 charactersrp	Repeat character %1 for %2 timesrP	Padding after character sent in replace moders	Reset stringRX	Turn off XON/XOFF flow controlsa	Set %1 %2 %3 %4 %5 %6 %7 %8 %9 attributesSA	enable automatic marginssc	Save cursor positionse	End standout modesf	Normal scroll one lineSF	Normal scroll %1 linesso	Start standout modesr	Reverse scrollSR	scroll back %1 linesst	Set tabulator stop in all rows at current columnSX	Turn on XON/XOFF flow controlta	move to next hardware tabtc	Read in terminal description from another entryte	End program that uses cursor motionti	Begin program that uses cursor motionts	Move cursor to column %1 of status lineuc	Underline character under cursor and move cursor rightue	End underliningup	Cursor up one lineUP	Cursor up %1 linesus	Start underliningvb	Visible bellve	Normal cursor visiblevi	Cursor invisiblevs	Standout cursorwi	Set window from line %1 to %2 and column %3 to %4XF	XOFF 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.
Increments parameters by one.
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
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:

+	right arrow (>),	left arrow (<).	down arrow (v)0	full square (#)I	lantern (#)-	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 the curses library, if the capabilities are missing.

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

2023-02-05Linux man-pages 6.03