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 environmentvariable. The system database for terminal capabilities is thefile /etc/termcap. The database is divided into entries for eachterminal model or terminal mode for a given model. Fields in theentry are separated by colons (:). The first field is a list ofalternate names for the terminal, which are separated by pipecharacters (|). Here is an example of a name field:


    d0|vt100|vt100-am|vt100am|dec vt100:

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 (thisis 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 terminaland 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:

  1. 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 repeatthe 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,

  2. 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
    behaves.
  3. Many terminals can operate in ‘VT100 mode’. If your terminal can, set it to VT100 mode and use vt100.
  4. 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 butwhich 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 termcapfile 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 writingentries. For an expanded explanation, see the book Termcap & Terminfo by John Strang, Tim O’Reilly, and Linda Mui (NutshellHandbooks, O’Reilly & Associates, Inc.).