curses is a terminal control library for Unix-like systems, enabling the construction of text user interface (TUI) applications.
The name is a pun on the term “cursor optimization”. It is a library of functions that manage an application's display on character-cell terminals (e.g., VT100).
Using curses, programmers are able to write text-based applications without writing directly for any specific terminal type. The curses library on the executing system sends the correct control characters based on the terminal type. It provides an abstraction of one or more windows that maps onto the terminal screen. Each window is represented by a character matrix. The programmer sets up each window to look as they want the display to look, and then tells the curses package to update the screen. The library determines a minimal set of changes that are needed to update the display and then executes these using the terminal's specific capabilities and control sequences.
In short, this means that the programmer simply creates a character matrix of how the screen should look and lets curses handle the work.
The curses API is described in several places. Most implementations of curses use a database that can describe the capabilities of thousands of different terminals. There are a few implementations, such as PDCurses, which use specialized device drivers rather than a terminal database. Most implementations use terminfo; some use termcap. Curses has the advantage of back-portability to character-cell terminals and simplicity. For an application that does not require bit-mapped graphics or multiple fonts, an interface implementation using curses will usually be much simpler and faster than one using an X toolkit.
The first curses library was written by Ken Arnold and originally released with BSD UNIX, where it was used for several games, most notably Rogue. Some improvements were made to the BSD library in the 1990s as "4.4BSD" curses, e.g., to provide more than one type of video highlighting. However, those are not widely used.