A program that wants to make use of the terminal capability database selects an entry according to the value of the TERM . This variable is typically set when a user logs in. A second variable, either or TERMINFO, may also be set, if it is desirable to point to a terminal description that is not in the standard location.
It's easy enough to find out what terminal type the system thinks you are currently using. Simply type:
If nothing is printed, TERM has not been set. (In the C shell,
variable will be printed.)
It's also easy enough to set the terminal type. This is typically done when the user logs in but can be done from the command line as follows:
TERM=wy50; export TERM%
setenv TERM wy50
But what if you sit down at a strange terminal and want to set the terminal type? How do you know what terminal name to use as the value of TERM?
The terminal names to which TERM can legitimately be set can be determined by searching through /etc/termcap or by listing the names of files in the /usr/lib/terminfo directory hierarchy.
The termcap terminal database is stored in the single file /etc/termcap. It is an ASCII file: all the information it contains is readable, if not immediately comprehensible. Each entry consists of a list of names for the terminal, followed by a list of the terminal's capabilities.
The first line of each entry shows several different names, or aliases, for the terminal. At least one of the names will usually reflect the manufacturer's shorthand name for the terminal, but a long name is usually included as well, so you can simply search for the manufacturer's name to get started. For example, if you were using a Wyse Technologies Wyse-50, you could check to make sure that a terminal description for that terminal existed in the termcap database by typing:
grep Wyse /etc/termcapn9|wy50|Wyse Technology WY-50:\
One or more lines like the one shown in the preceding example should be
printed (if any matching entries are found). Each line will show
several names for the terminal, separated by vertical bars (
The second name,
wy50, is the one most
commonly used as the value of TERM.
The compiled terminfo database is stored in a directory hierarchy under /usr/lib/terminfo. Each terminal entry is compiled (by a program called tic) and stored in a separate file. All terminals whose names begin with the letter "a" are stored in the directory /usr/lib/terminfo/a, and so on through the alphabet.  are used so that the terminal description can be accessed with any one of several names. [The command will list all the descriptions at once. A command like will find descriptions with a certain brand or model xxx in the name. -JP ]
 The source is sometimes provided by some systems in /usr/lib/terminfo.ti. Entries can be decompiled or displayed with a program called infocmp.
So, on a system supporting terminfo, you would look for the entry with the ls command:
ls /usr/lib/terminfo/wwy-50 wy100 wy50 wyse-50 wyse50
You should use the name of the appropriate file for the value of TERM.
tput -Twy50 longnameWyse Technologies Wy-50
You should be aware that for a terminal with configurable options (such as a terminal with an 80- or 132-column mode), there may be several termcap or terminfo entries. Until you know enough about the terminal database to compare the entries and find out how they differ, you will simply need to take your chances. Experiment with each of the entries and see which works best. Article 41.11 explains more about the format of termcap and terminfo entries. [If none of them seem to work, setting TERM to a name like dumb or unknown will give you a basic setup while you check other entries. The vi editor will use its and pagers like will complain a little, but you should be able to get by. -JP ]
- from O'Reilly & Associates' termcap & terminfo, Chapter 2