O'Reilly logo

Essential System Administration, 3rd Edition by Æleen Frisch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Specifying Terminal Characteristics

Unix programs are generally written to beterminal-independent: they don’t know about or rely on the specific characteristics of any particular kind ofterminal, but rather, they call a standard screen manipulation library that is responsible for interfacing to actual terminals. Such libraries serve to map general terminal characteristics and functions (e.g., clearing the screen) to the specific character sequences required to perform them on any specific terminal.

Terminal definitions are stored in databases on the system, and users indicate what kind of terminal they are using by setting the TERM environment variable (usually at login time). These databases are handled differently under BSD and System V and are the subject of the next section.

termcap and terminfo

Programs use the name specified in the TERM environment variable as a key into the system terminal definitions database. Under the BSD scheme, terminal definitions are stored in the file /etc/termcap ; under System V, they are stored in the subdirectories of the terminfo top-level subdirectory. Some systems provide both facilities:

AIX
/usr/lib/terminfo
FreeBSD
/etc/termcap (a link to /usr/share/misc/termcap)
Linux
/etc/termcap and /usr/share/terminfo
HP-UX
/usr/lib/terminfo (a link to /usr/share/lib/terminfo)
Solaris
/etc/termcap and /usr/share/lib/terminfo
Tru64
/usr/share/lib/termcap and /usr/lib/terminfo

This section provides a brief overview of termcap and terminfo entries. See the Nutshell ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required