Next Previous Contents

## 5. Basic Concepts About Termcap and Terminfo

The file `/etc/termcap` is a text file that lists the `term`inal `cap`abilities. Several applications use the `termcap` information to move the cursor around the screen and do other screen-oriented tasks. `tcsh`, `bash`, `vi` and all the `curses`-based applications use the `termcap` database.

The database describes several terminal types. The `TERM` environment variable selects the right behaviour at run-time, by naming a `termcap` entry to be used by applications.

Within the database, each capability of the terminal appears as a two-letter code and a representation of the actual escape sequence used to get the desired effect. The separator character between different capabilities is the colon (":"). As an example, the audible bell, with code "bl", usually appears as "`bl=^G`". This sequence tells that the bell sound is obtained by printing the control-G character, the ASCII BEL.

In addition to the `bl` capability, the `vb` capability is recognized. It is used to represent the "visible bell". `vb` is usually missing in the `linux` entry of the `termcap` file.

Most modern applications and libraries use the `terminfo` database instead of `termcap`. This database uses one file per terminal-type and lives in `/usr/lib/terminfo`; to avoid using huge directories, the description of each terminal type is stored in a directory named after its first letter; the `linux` entry, therefore, is `/usr/lib/terminfo/l/linux`. To build a `terminfo` entry you'll ``compile'' the `termcap` description; refer to the `tic` program and its manual page.

Next Previous Contents