Setting Your Terminal Type
Logging in to UNIX requires setting your terminal type. As part of this process, UNIX retrieves the capabilities for your terminal from a database and puts them in your TERMCAP environment variable. The system database for terminal capabilities is the file /etc/termcap. The database is divided into entries for each terminal model or terminal mode for a given model. Fields in the entry are separated by colons (:). The first field is a list of alternate names for the terminal, which are separated by pipe characters (|). Here is an example of a name field:
The meanings of the entries are as follows:
- First entry is two characters, where the first character is the manufacturer.
- Second entry is the standard abbreviation for the model or mode.
- Third entry is the one the editor will print with "set" command.
- Last entry is a verbose description of the model or mode.
- Other entries are mnemonic synonyms for the terminal.
If a program absolutely MUST check for a specific terminal (this is discouraged) make it check for the second entry (the standard form) since all other codes are subject to change. In particular, the two-letter codes are extremely subject to change.
If you are unsure of which termcap entry is correct for your terminal and application, check /etc/termcap for possible comments. Comments begin with a # and normally appear above the entry.
If you cannot find an entry for your terminal, here are some suggestions to follow in the order given:
- Look for a termcap entry in /etc/termcap by typing:
grep my_terminal_type /etc/termcap
If the grep command finds many termcap entries for the terminal but with different suffixes, look at /etc/termcap using view to see if there are any comments in the file which explain the difference between similar entries.
If the grep command is unsuccessful, you may want to repeat the search with an abbreviated name in case there are entries for other models with similar capabilities. For example, if grep vt220x /etc/termcap fails, try grep vt2 /etc/termcap.
Grep may turn up many termcap entries for the same terminal,
- If you can find an entry for a terminal which is similar to
yours, try it with a command such as vi to see how it
- Many terminals can operate in 'VT100 mode'. If your terminal can, set it to VT100 mode and use vt100.
- If all else fails, use dumb but contact the terminal's manufacturer for a possible termcap entry.
NEW TERMCAP ENTRIES
If you have a termcap entry which works for your terminal but
which is not in /etc/termcap, you are invited to mail it to
termcap@berkeley for possible inclusion in a future version of
/etc/termcap. In the mean time, you can create your own termcap
file and use it. The simple way to access it is to put at the
top of your .login file the line:
setenv TERMCAP ~/mytermcap
where mytermcap is the name of a termcap file in your home directory. Type help .login for more ideas.
The manual entry man 5 termcap lists and describes all termcap capabilities. It also has several pages of details on writing entries. For an expanded explanation, see the book Termcap & Terminfo by John Strang, Tim O'Reilly, and Linda Mui (Nutshell Handbooks, O'Reilly & Associates, Inc.).