ncurses (New curses) is a free library providing an API for the development of user interfaces with drop-down menus, using the characters and colors of a semi-graphical mode. Not only is this type of user interface designed independently of the terminal, but it speeds up screen refresh, thereby reducing the latency typically experienced by remote shell users (Read Text User Interface, TUI).
The first semi-graphic library, curses, was programmed around 1980 at the University of Berkeley for the port of the game Rogue to Unix BSD. It used the termcap library, itself developed for the vi line editor.
Given the reception given to BSD curses, Bell Labs decided to include it in version 2 of Unix System V, with some improvements and using terminfo, a faster access database, instead of termcap; however, given AT&T’s restrictive policy on rights protection, this improved version of curses was less successful than the first. Around 1982, Pavel Curtis began to develop a free clone, pcurses, which was maintained by several users until 1986. Ncurses is a free simulation of the classic 4.4BSD implementation of curses, whose evolution is now stopped.
In the early 1990s, Zeyd Ben Halim and Eric Raymond continued the development of pcurses and called it ncurses, which is now predominantly in use. Thomas Dickey joined the project in 1995 and has been the lead developer since 1996. This is the official website of Thomas Dickey for ncurses project:
There are many programs which use ncurses. GNU Screen and w3m, use only the termcap interface and perform screen management themselves. Lynx, GNU Midnight Commander and YaST, use the curses programming interface.
This is an example of Hello World program in C++ using ncurses:
using namespace std;
int main(int argc, char ** argv)
// init screen and sets up screen
// print to screen
// refreshes the screen
// ends ncurses
You can read these two articles which are related to ncurses:
- List of Command Line Music Players For Mac, Linux
- How To Build Colorful Command Line TUI For Shell Scripts