Readablewiki

Terminfo

Content sourced from Wikipedia, licensed under CC BY-SA 3.0.

Terminfo is a library and database that lets programs use display terminals in a device‑independent way. It was created by Mary Ann Horton in 1981–1982 as an improvement over termcap and became the preferred terminal description format in UNIX System V Release 2, while BSD continued using termcap. It influenced other projects like pcurses, and many Unix systems adopted or adapted it.

A terminfo database describes many terminals. Each terminal entry has a canonical name (plus optional aliases) that the library uses to look up capabilities. Capabilities are typed as boolean, numeric, or string. String capabilities can be escape sequences to send to the terminal or sequences that applications send, with a small stack‑based parser to substitute parameters and reduce the amount of data sent (for examples like SGR).

Descriptions can include content from other descriptions, or override or remove capabilities. The data is stored as a compiled binary file (created with a tool like tic) and is retrieved by the library. Terminfo data is organized into tables for boolean, numeric, and string capabilities.

Open Group limits for terminfo sources include a 14‑character filename limit (a holdover from old filesystems) and a 32767 limit for positive numeric values; negative numbers can indicate absent values. Terminfo has both a source form and a compiled form, but compiled entries don’t include standardized metadata about table indices, so portability between implementations isn’t guaranteed. Still, many systems share the same overall structure, allowing tools like ncurses to read data from multiple implementations.

The original terminfo layout used a directory hierarchy, typically using the first letter of a terminal’s name as part of the path and the terminal name as the file name. Some systems use a hashed database that stores aliases pointing to a canonical entry and the entry itself.


This page was last edited on 3 February 2026, at 19:49 (CET).