TERMCAP(5) FILE FORMATS TERMCAP(5)
NAME
termcap - terminal capability data base
DESCRIPTION
termcap is a data base describing the capabilities of termi-
nals. Terminals are described in termcap source descrip-
tions by giving a set of capabilities which they have, by
describing how operations are performed, by describing pad-
ding requirements, and by specifying initialization
sequences. This database is used by applications programs
such as vi(1), and libraries such as curses(3V), so they can
work with a variety of terminals without changes to the pro-
grams.
Each termcap entry consist of a number of colon-separated
(:) fields. The first field for each terminal lists the
various names by which it is known, separated by bar ( | )
characters. The first name is always two characters long,
and is used by older (version 6) systems (which store the
terminal type in a 16-bit word in a system-wide database).
The second name given is the most common abbreviation for
the terminal (this is the one to which the environment vari-
able TERM would normally be set). The last name should
fully identify the terminal's make and model. All other
names are taken as synonyms for the initial terminal name.
All names but the first and last should be in lower case and
contain no blanks; the last name may well contain upper case
and blanks for added readability.
Terminal names (except for the last, verbose entry) should
be chosen using the following conventions:
+ The particular piece of hardware making up the terminal
should have a root name chosen; for example, for the
Hewlett-Packard 2621, hp2621. This name should not con-
tain hyphens.
+ Modes that the hardware can be in or user preferences
should be indicated by appending a hyphen and an indica-
tor of the mode. Thus, a vt100 in 132-column mode would
be given as: vt100-w. The following suffixes should be
used where possible:
Suffix Meaning Example
-w wide mode (more than 80 columns) vt100-w
-am with automatic margins (usually default) vt100-am
-nam without automatic margins vt100-nam
-n number of lines on the screen aaa-60
-na no arrow keys (leave them in local) concept100-na
-np number of pages of memory concept100-4p
-rv reverse video concept100-rv
Terminal entries may continue onto multiple lines by giving
a \ as the last character of a line, and empty fields may be
included for readability (here between the last field on a
line and the first field on the next). Comments may be
included on lines beginning with #.
Types of Capabilities
Terminal capabilities each have a two-letter code, and are
of three types:
boolean These indicate particular features of the termi-
nal. For instance, an entry for a terminal that
has automatic margins (an automatic RETURN and
LINEFEED when the end of a line is reached)
would contain a field with the boolean capabil-
ity am.
numeric These give the size of the display of some other
attribute. Numeric capabilities are followed by
the character `#', and a number. An entry for a
teminal with an 80-column display would have a
field containing co#80.
string These indicate the character sequences used to
perform particular terminal operations.
String-valued capabilities, such as ce (clear-
to-end-of-line sequence) are given by the two-
letter code, followed by the character `=', and
a string (which ends at the following : field
delimiter).
A delay factor, in milliseconds may appear after the `='.
Padding characters are supplied by tputs after the remainder
of the string is sent. The delay can be either a number, or
a number followed by the character `*', which indicates that
the proportional padding is required, in which case the
number given is the amount of padding for each line affected
by an operation using that capability. (In the case of an
insert-character operation, the factor is still the number
of lines affected; this is always 1 unless the terminal has
in and the software uses it.)
When a * is specified, it is sometimes useful to give a
delay of the form 3.5 to specify a delay per line to tenths
of milliseconds. (Only one decimal place is allowed.)
Comments
To comment-out a capability field, insert a `.' (period) as
the first character in that field (following the :).
Escape Sequence Codes
A number of escape sequences are provided in the string-
valued capabilities for easy encoding of characters there:
\E maps to ESC
^X maps to CTRL-X for any appropriate character X
\n maps to LINEFEED
\r maps to RETURN
\t maps to TAB
\b maps to BACKSPACE
\f maps to FORMFEED
Finally, characters may be given as three octal digits after
a backslash (for example, \123), and the characters ^
(caret) and \ (backslash) may be given as \^ and \\ respec-
tively.
If it is necessary to place a : in a capability it must be
escaped in octal as \072.
If it is necessary to place a NUL character in a string
capability it must be encoded as \200. (The routines that
deal with termcap use C strings and strip the high bits of
the output very late, so that a \200 comes out as a \000
would.)
Parameterized Strings
Cursor addressing and other strings requiring parameters are
described by a parameterized string capability, with
printf(3V)-like escapes (%x) in it; other characters are
passed through unchanged. For example, to address the cur-
sor, the cm capability is given, using two parameters: the
row and column to move to. (Rows and columns are numbered
from zero and refer to the physical screen visible to the
user, not to any unseen memory. If the terminal has
memory-relative cursor addressing, that can be indicated by
an analogous CM capability.)
The % escapes have the following meanings:
%% produce the character %
%d output value as in printf %d
%2 output value as in printf %2d
%3 output value as in printf %3d
%. output value as in printf %c
%+x add x to value, then do `%.'
%>xy if value > x then add y, no output
%r reverse order of two parameters, no output
%i increment by one, no output
%n exclusive-or all parameters with 0140 (Datamedia
2500)
%B BCD (16*(value/10)) + (value%10), no output
%D Reverse coding (value - 2*(value%16)), no output
(Delta Data)
Consider the Hewlett-Packard 2645, which, to get to row 3
and column 12, needs to be sent \E&a12c03Y padded for 6 mil-
liseconds. Note: the order of the row and column coordi-
nates is reversed here and that the row and column are sent
as two-digit integers. Thus its cm capability is
`:cm=6\E&%r%2c%2Y:'. Terminals that use `%.' need to be
able to backspace the cursor (le) and to move the cursor up
one line on the screen (up). This is necessary because it
is not always safe to transmit \n, ^D, and \r, as the system
may change or discard them. (Programs using termcap must
set terminal modes so that TAB characters are not expanded,
making \t safe to send. This turns out to be essential for
the Ann Arbor 4080.)
A final example is the Lear Siegler ADM-3a, which offsets
row and column by a blank character, thus it requires
`:cm=\E=%+ %+:'.
Row or column absolute cursor addressing can be given as
single-parameter capabilities ch (horizontal position abso-
lute) and cv (vertical position absolute). Sometimes these
are shorter than the more general two-parameter sequence (as
with the Hewlett-Packard 2645) and can be used in preference
to cm. If there are parameterized local motions (for exam-
ple, move n positions to the right) these can be given as
DO, LE, RI, and UP with a single parameter indicating how
many positions to move. These are primarily useful if the
terminal does not have cm, such as the Tektronix 4025.
Delays
Certain capabilities control padding in the terminal driver.
These are primarily needed by hardcopy terminals and are
used by the tset (1) program to set terminal driver modes
appropriately. Delays embedded in the capabilities cr, sf,
le, ff, and ta will set the appropriate delay bits in the
terminal driver. If pb (padding baud rate) is given, these
values can be ignored at baud rates below the value of pb.
For 4.2BSD tset, the delays are given as numeric capabili-
ties dC, dN, dB, dF, and dT instead.
Similar Terminals
If there are two very similar terminals, one can be defined
as being just like the other with certain exceptions. The
string capability tc can be given with the name of the simi-
lar terminal. This capability must be last, and the com-
bined length of the entries must not exceed 1024. The capa-
bilities given before tc override those in the terminal type
invoked by tc. A capability can be canceled by placing xx@
to the left of the tc invocation, where xx is the capabil-
ity. For example, the entry
hn|2621-nl:ks@:ke@:tc=2621:
defines a 2621-nl that does not have the ks or ke capabili-
ties, hence does not turn on the function key labels when in
visual mode. This is useful for different modes for a ter-
minal, or for different user preferences.
CAPABILITIES
The characters in the Notes field in the next table have the
following meanings (more than one may apply to a capabil-
ity):
N indicates numeric parameter(s)
P indicates that padding may be specified
* indicates that padding may be based on the number of
lines affected
o indicates capability is obsolete
Obsolete capabilities have no terminfo equivalents, since
they were considered useless, or are subsumed by other capa-
bilities. New software should not rely on them.
Name Type Notes Description
!1 str sent by shifted save key
!2 str sent by shifted suspend key
!3 str sent by shifted undo key
#1 str sent by shifted help key
#2 str sent by shifted home key
#3 str sent by shifted input key
#4 str sent by shifted left-arrow key
%0 str sent by redo key
%1 str sent by help key
%2 str sent by mark key
%3 str sent by message key
%4 str sent by move key
%5 str sent by next-object key
%6 str sent by open key
%7 str sent by options key
%8 str sent by previous-object key
%9 str sent by print or copy key
%a str sent by shifted message key
%b str sent by shifted move key
%c str sent by shifted next-object key
%d str sent by shifted options key
%e str sent by shifted previous-object key
%f str sent by shifted print or copy key
%g str sent by shifted redo key
%h str sent by shifted replace key
%i str sent by shifted right-arrow key
%j str sent by shifted resume key
&0 str sent by shifted cancel key
&1 str sent by ref(erence) key
&2 str sent by refresh key
&3 str sent by replace key
&4 str sent by restart key
&5 str sent by resume key
&6 str sent by save key
&7 str sent by suspend key
&8 str sent by undo key
&9 str sent by shifted beg(inning) key
*0 str sent by shifted find key
*1 str sent by shifted cmd (command) key
*2 str sent by shifted copy key
*3 str sent by shifted create key
*4 str sent by shifted delete-char key
*5 str sent by shifted delete-line key
*6 str sent by select key
*7 str sent by shifted end key
*8 str sent by shifted clear-line key
*9 str sent by shifted exit key
5i bool printer will not echo on screen
@0 str sent by find key
@1 str sent by beg(inning) key
@2 str sent by cancel key
@3 str sent by close key
@4 str sent by cmd (command) key
@5 str sent by copy key
@6 str sent by create key
@7 str sent by end key
@8 str sent by enter/send key (unreliable)
@9 str sent by exit key
AL str (NP*) add n new blank lines
CC str terminal settable command character in
prototype
CM str (NP) memory-relative cursor motion to row m,
column n
DC str (NP*) delete n characters
DL str (NP*) delete n lines
DO str (NP*) move cursor down n lines
EP bool (o) even parity
F1-F9 str sent by function keys 11-19
FA-FZ str sent by function keys 20-45
Fa-Fr str sent by function keys 46-63
HC bool cursor is hard to see
HD bool (o) half-duplex
IC str (NP*) insert n blank characters
K1 str sent by keypad upper left
K2 str sent by keypad center
K3 str sent by keypad upper right
K4 str sent by keypad lower left
K5 str sent by keypad lower right
LC bool (o) lower-case only
LE str (NP) move cursor left n positions
LF str (P) turn off soft labels
LO str (P) turn on soft labels
MC str (P) clear left and right soft margins
ML str (P) set soft left margin
MR str (P) set soft right margin
NL bool (o) \n is NEWLINE, not LINEFEED
NP bool pad character does not exist
NR bool ti does not reverse te
Nl num number of labels on screen (start at 1)
OP bool (o) odd parity
RA str (P) turn off automatic margins
RF str send next input character (for ptys)
RI str (NP) move cursor right n positions
RX str (P) turn off xoff/xon handshaking
SA str (P) turn on automatic margins
SF str (NP*) scroll forward n lines
SR str (NP*) scroll backward n lines
SX str (P) turn on xoff/xon handshaking
UC bool (o) upper-case only
UP str (NP*) move cursor up n lines
XF str x-off character (default DC3)
XN str x-on character (default DC1)
ac str graphic character set pairs aAbBcC -
def=VT100
ae str (P) end alternate character set
al str (P*) add new blank line
am bool terminal has automatic margins
as str (P) start alternate character set
bc str (o) backspace if not ^H
bl str (P) audible signal (bell)
bs bool (o) terminal can backspace with ^H
bt str (P) back-tab
bw bool le (backspace) wraps from column 0 to
last column
cb str (P) clear to beginning of line, inclusive
cd str (P*) clear to end of display
ce str (P) clear to end of line
ch str (NP) set cursor column (horizontal position)
cl str (P*) clear screen and home cursor
cm str (NP) screen-relative cursor motion to row
m, column n
co num number of columns in a line
cr str (P*) RETURN
cs str (NP) change scrolling region to lines m
through n (VT100)
ct str (P) clear all tab stops
cv str (NP) set cursor row (vertical position)
dB num (o) milliseconds of bs delay needed (default 0)
dC num (o) milliseconds of cr delay needed (default 0)
dF num (o) milliseconds of ff delay needed (default 0)
dN num (o) milliseconds of nl delay needed (default 0)
dT num (o) milliseconds of horizontal tab delay
needed (default 0)
dV num (o) milliseconds of vertical tab delay
needed (default 0)
da bool display may be retained above the screen
db bool display may be retained below the screen
dc str (P*) delete character
dl str (P*) delete line
dm str enter delete mode
do str down one line
ds str disable status line
eA str (P) enable graphic character set
ec str (NP) erase n characters
ed str end delete mode
ei str end insert mode
eo bool can erase overstrikes with a blank
es bool escape can be used on the status line
ff str (P*) hardcopy terminal page eject
fs str return from status line
gn bool generic line type (for example
dialup, switch)
hc bool hardcopy terminal
hd str half-line down (forward 1/2 linefeed)
ho str (P) home cursor
hs bool has extra "status line"
hu str half-line up (reverse 1/2 linefeed)
hz bool cannot print ~s (Hazeltine)
i1 str terminal initialization string
(terminfo only)
i3 str terminal initialization string
(terminfo only)
iP str pathname of program for initialization
(terminfo only)
ic str (P*) insert character
if str name of file containing
initialization string
im str enter insert mode
in bool insert mode distinguishes nulls
ip str (P*) insert pad after character inserted
is str terminal initialization
string
it num tab stops initially every
n positions
k0-k9 str sent by function keys 0-9
k; str sent by function key 10
kA str sent by insert-line key
kB str sent by back-tab key
kC str sent by clear-screen or erase key
kD str sent by delete-character key
kE str sent by clear-to-end-of-line key
kF str sent by scroll-forward/down key
kH str sent by home-down key
kI str sent by insert-character or
enter-insert-mode key
kL str sent by delete-line key
kM str sent by insert key while in
kN str sent by next-page key
kP str sent by previous-page key
kR str sent by scroll-backward/up key
kS str sent by clear-to-end-of-screen key
kT str sent by set-tab key
ka str sent by clear-all-tabs key
kb str sent by backspace key
kd str sent by down-arrow key
ke str out of "keypad transmit" mode
kh str sent by home key
kl str sent by left-arrow key
km bool has a "meta" key (shift, sets
parity bit)
kn num (o) number of function (k0-k9) keys
(default 0)
ko str (o) termcap entries for other
non-function keys
kr str sent by right-arrow key
ks str put terminal in "keypad transmit"
mode
kt str sent by clear-tab key
ku str sent by up-arrow key
l0-l9 str labels on function keys 0-9 if not f0-f9
la str label on function key 10 if not f10
le str (P) move cursor left one position
lh num number of rows in each label
li num number of lines on screen or page
ll str last line, first column
lm num lines of memory if > li (0 means varies)
lw num number of columns in each label
ma str (o) arrow key map (used by vi version 2 only)
mb str turn on blinking attribute
md str turn on bold (extra bright) attribute
me str turn off all attributes
mh str turn on half-bright attribute
mi bool safe to move while in insert mode
mk str turn on blank attribute (characters
invisible)
ml str (o) memory lock on above cursor
mm str turn on "meta mode" (8th bit)
mo str turn off "meta mode"
mp str turn on protected attribute
mr str turn on reverse-video attribute
ms bool safe to move in standout modes
mu str (o) memory unlock (turn off memory lock)
nc bool (o) no correctly-working cr (Datamedia
2500, Hazeltine 2000)
nd str non-destructive space (cursor right)
nl str (o) NEWLINE character if not
ns bool (o) terminal is a CRT but does not scroll
nw str (P) NEWLINE (behaves like cr followed by do)
nx bool padding will not work, xoff/xon required
os bool terminal overstrikes
pO str (N) turn on the printer for n bytes
pb num lowest baud where delays are required
pc str pad character (default NUL)
pf str turn off the printer
pk str program function key n to type string
s (terminfo only)
pl str program function key n to execute string
s (terminfo only)
pn str (NP) program label n to show string
s (terminfo only)
po str turn on the printer
ps str print contents of the screen
pt bool (o) has hardware tab stops (may need to be
set with is)
px str program function key n to transmit string
s (terminfo only)
r1 str reset terminal completely to sane modes
(terminfo only)
r2 str reset terminal completely to sane modes
(terminfo only)
r3 str reset terminal completely to sane modes
(terminfo only)
rP str (P) like ip but when in replace mode
rc str (P) restore cursor to position of last sc
rf str name of file containing reset string
ri ? unknown at present
rp str (NP*) repeat character c n times
rs str reset terminal completely to sane
modes
sa str (NP) define the video attributes
(9 parameters)
sc str (P) save cursor position
se str end standout mode
sf str (P) scroll text up
sg num number of garbage chars left by
so or se (default 0)
so str begin standout mode
sr str (P) scroll text down
st str set a tab stop in all rows, current
column
ta str (P) move cursor to next 8-position hardware
tab stop
tc str entry of similar terminal - must be last
te str string to end programs that use termcap
ti str string to begin programs that use termcap
ts str (N) go to status line, column n
uc str underscore one character and move past it
ue str end underscore mode
ug num number of garbage chars left by us or
ue (default 0)
ul bool underline character overstrikes
up str upline (cursor up)
us str start underscore mode
vb str visible bell (must not move cursor)
ve str make cursor appear normal (undo vs/vi)
vi str make cursor invisible
vs str make cursor very visible
vt num virtual terminal number (not supported
on all systems)
wi str (N) set current window to lines i
through j, columns m through n
ws num number of columns in status line
xb bool Beehive (f1=ESC, f2=^C)
xn bool NEWLINE ignored after 80 cols (Concept)
xo bool terminal uses xoff/xon handshaking
xr bool (o) RETURN acts like ce cr nl (Delta Data)
xs bool standout not erased by overwriting
(Hewlett-Packard)
xt bool TAB characters destructive, magic so char
(Teleray 1061)
xx bool (o) Tektronix 4025 insert-line
ENVIRONMENT
If the environment variable TERMCAP contains an absolute
pathname, programs look to that file for terminal descrip-
tions, rather than /usr/share/lib/termcap. If the value of
this variable is in the form of a termcap entry, programs
use that value for the terminal description.
FILES
/usr/share/lib/termcap
file containing terminal descriptions
SEE ALSO
ex(1), more(1), tset(1), ul(1), vi(1), curses(3V),
printf(3V), termcap(3X), term(5V), terminfo(5V)
System and Network Administration
WARNINGS
UNIX System V uses terminfo(5V) rather than termcap. SunOS
supports either termcap or terminfo(5V) terminal databases,
depending on whether you link with the termcap(3X) or
curses(3V) libraries. Transitions between the two should be
relatively painless if capabilities flagged as "obsolete"
are avoided.
vi allows only 256 characters for string capabilities, and
the routines in termcap(3X) do not check for overflow of
this buffer. The total length of a single entry (excluding
only escaped NEWLINE characters) may not exceed 1024.
Not all programs support all entries.
Sun Release 4.1 Last change: 16 February 1988
REPORTS
Analyize In-Line NAC strategies and products.
ANALYTICS Plan and design your enterprise blade server deployments
InformationWeek U.S. IT Salary Survey 2008
Salaries for business technology professionals are falling. Here's what you need to know in order to make good hiring decisions and personal career choices. Download Today