Because vim, emacs, Terminal, and other programs take advantage of features that are specific to various kinds of terminals and terminal emulators, you must tell these programs the name of the terminal you are using or the terminal that your terminal emulator is emulating. Frequently your terminal name is set for you. If your terminal name is not specified or is not specified correctly, your screen will look garbled or, when you start a program, the program will ask what type of terminal you are using.
Terminal names describe the functional characteristics of a terminal or terminal emulator to programs that require this information. Although terminal names are referred to as being either Terminfo or Termcap names, the difference relates to the method that each system uses to store the terminal characteristics internallynot to the manner that you specify the name of a terminal. Terminal names that are often used with terminal emulators and with graphical monitors while they are run in text mode include ansi, vt100, vt102, vt220, and xterm.
When you are running a terminal emulator, you can specify the type of terminal you want to emulate. Set the emulator to either vt100 or vt220, and set TERM to the same value.
When you log in, you may be prompted to identify the type of terminal you are using:
TERM = (vt100)
There are two ways to respond to this prompt. You can press RETURN to set your terminal type to the name in parentheses. Alternatively, when that name does not describe the terminal you are using, you can enter the correct name and then press RETURN.
TERM = (vt100) ansi
You may also receive the following prompt:
TERM = (unknown)
This prompt indicates that the system does not know what type of terminal you are using. If you plan to run programs that require this information, enter the name of the terminal or terminal emulator you are using before you press RETURN.
If you do not receive a prompt, you can give the following command to display the value of the TERM variable and check whether your terminal type has been set:
$ echo $TERM
If the system responds with the wrong name, a blank line, or an error message, set or change the terminal name. From the Bourne Again Shell (bash), enter a command similar to the following to set the TERM variable so that the system knows the type of terminal you are using:
Replace name with the terminal name for the terminal you are using, making sure that you do not put a SPACE before or after the equal sign. If you always use the same type of terminal, you can place this command in your ~/.bashrc file (page 259), causing the shell to set the terminal type each time you log in. For example, give the following command to set your terminal name to vt100:
$ export TERM=vt100
Use the following format under the TC Shell (tcsh):
setenv TERM name
Again, replace name with the terminal name for the terminal you are using. Under tcsh you can place this command in your ~/.login file (page 340). For example, under tcsh you can give this command to set your terminal name to vt100:
$ setenv TERM vt100
For some programs to display information correctly, you may need to set the LANG variable (page 291). Frequently you can set this variable to C. Under bash use the command
$ export LANG=C
Under tcsh use the command
$ setenv LANG C