ArticleslgStudy

computer science

Ncurses

Ncurses is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Ncurses rather than just read about it. In short: ncurses (new curses) is a programming library for creating textual user interfaces (TUIs) that work across a wide variety of terminals. It is written in a way that attempts to optimize the commands that are sent to the terminal, to reduce the latency experienced when updating the displayed content. ncurses is a free and open-source software emulation of curses from System V Release 4.0 (SVr4).

Ncurses — main illustration
Ncurses — illustration

Key takeaways

  • Ncurses belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Ncurses to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Ncurses from memory before moving on to harder problems.

Reference excerpt

ncurses (new curses) is a programming library for creating textual user interfaces (TUIs) that work across a wide variety of terminals. It is written in a way that attempts to optimize the commands that are sent to the terminal, to reduce the latency experienced when updating the displayed content. ncurses is a free and open-source software emulation of curses from System V Release 4.0 (SVr4). There are bindings for ncurses in a variety of programming languages, including Ada, Common Lisp, Python, Gambas, Ruby, PHP, JavaScript, Perl, Object REXX (ooRexx) and Rust.

History As the new version, ncurses is a free and open-source software emulation of the System V Release 4.0 (SVr4) curses, which was an enhancement over the discontinued 4.4 BSD curses. The XSI Curses standard issued by X/Open is explicitly and closely modeled on UNIX System V.

curses

The first curses library was developed at University of California, Berkeley, for a BSD operating system, around 1980 to support Rogue, a text-based adventure game. It originally used the termcap library, which was used in other programs, such as the vi editor. The success of the BSD curses library prompted Bell Labs to release an enhanced curses library in their System V Release 2 Unix systems. This library was more powerful and instead of using termcap, it used terminfo. However, due to AT&T's policy regarding the distribution of source code, the improved curses library was not widely adopted in the BSD community.

pcurses Around 1982, Pavel Curtis started work on a freeware clone of the Bell Labs curses, named pcurses, which was maintained by various people through 1986.

ncurses The pcurses library was further improved when Zeyd Ben-Halim took over the development effort in late 1991. The new library was released as ncurses in November 1993, with version 1.8.1 as the first major release. Subsequent work, through version 1.8.8 (M1995), was driven by Eric S. Raymond, who added the form and menu libraries written by Juergen Pfeifer. Since 1996, it has been maintained by Thomas E. Dickey. Most ncurses calls can be easily ported to the old curses. System V curses implementations can support BSD curses programs with just a recompilation. However, a few areas are problematic, such as handling terminal resizing, since no counterpart exists in the old curses.

Terminal database ncurses can use either terminfo (with extensible data) or termcap. Other implementations of curses generally use terminfo; a minority use termcap. Few (mytinfo was an older exception) use both.

License ncurses is a part of the GNU Project, but is not distributed under the GNU General Public License (GPL) or GNU Lesser General Public License (LGPL). Instead, it is distributed under a permissive free software licence: the MIT License. This is due to the agreement made with the Free Software Foundation at the time the developers assigned their copyright. When the agreement was made to pass on the rights to the FSF, there was a clause that stated:

The Foundation promises that all distribution of the Package, or of any work "based on the Package", that takes place under the control of the Foundation or its agents or assignees, shall be on terms that explicitly and perpetually permit anyone possessing a copy of the work to which the terms apply, and possessing accurate notice of these terms, to redistribute copies of the work to anyone on the same terms.

According to the maintainer Thomas E. Dickey, this precludes relicensing to the GPL in any version, since it would place restrictions on the programs that will be able to link to the libraries.

Programs using ncurses Hundreds of programs use ncurses. Some, such as GNU Screen and w3m, use only the termcap interface and perform screen management themselves. Others, such as GNU Midnight Commander and Yet another Setup Tool (YaST), use the curses programming interface.

See also

conio.h – A C header file used mostly with MS-DOS compilers to create text user interfaces Curses Development Kit Dialog (software) PDCurses S-Lang programming library SMG$ – Screen-management library available under OpenVMS GNU Readline

References

External links Official website

Illustrations

Ncurses illustration

Worked examples

Example 1 — a first encounter with Ncurses

Start with the simplest possible case. Write down what Ncurses claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Ncurses before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Ncurses ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Ncurses

In research
Ncurses appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Ncurses in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Ncurses is common in secondary-school and first-year university syllabi. It links to neighbouring topics C (programming language) libraries, Free software programmed in Ada, Free software programmed in C, so understanding it makes those chapters shorter.
In everyday life
Look for Ncurses outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Ncurses” →

How to study Ncurses in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Ncurses means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Ncurses out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Ncurses in simple terms?

ncurses (new curses) is a programming library for creating textual user interfaces (TUIs) that work across a wide variety of terminals. It is written in a way that attempts to optimize the commands that are sent to the terminal, to reduce the latency experienced when updating the displayed content…

Why does Ncurses matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Ncurses?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Ncurses.

Tags

  • C (programming language) libraries
  • Free software programmed in Ada
  • Free software programmed in C
  • GNU Project software
  • Ncurses
  • Software using the MIT license
  • Termcap
  • Terminfo

Keep exploring