ArticleslgStudy

science

Tput

Tput is a 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 Tput rather than just read about it. In short: In computing, tput is a standard Unix operating system command which makes use of terminal capabilities. Depending on the system, tput uses the terminfo or termcap database, as well as looking into the environment for the terminal type.

Key takeaways

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

Reference excerpt

In computing, tput is a standard Unix operating system command which makes use of terminal capabilities. Depending on the system, tput uses the terminfo or termcap database, as well as looking into the environment for the terminal type.

History tput was provided in UNIX System V in the early 1980s. A clone of the AT&T tput was submitted to volume 7 of the mod.sources newsgroup (later comp.sources.unix) in September 1986. In contrast to the System V program, the clone used termcap rather than terminfo. It accepted command-line parameters for the cm (cursor addressing) capability, and recognized terminfo capability names. System V Release 3 provided an improved version which combined the different initialization capabilities as a new option init, and the reset capabilities as reset, thereby simplifying use of tput for initializing or reinitializing the terminal. System V Release 3.2 added several printer-specific capabilities to the terminfo database, such as swidm (enter_doublewide_mode) which tput could use. It also added capabilities for color. System V Release 4 defined additional terminfo capabilities including standardized ANSI color capabilities setaf and setab, which could be used by tput. BSD platforms provided a different implementation of tput in 4.3BSD-Reno (June 1990). It used termcap, recognizing only termcap capability names, and did not accept command-line parameters for cursor-addressing. FreeBSD used this in 1994, improving it by accepting one or two numeric command-line parameters. Ross Ridge's mytinfo package in 1992 provided a tput which accepted either termcap or terminfo capability names. Like the Reno implementation, it did not pass command-line arguments to parameterized capabilities. ncurses incorporated the mytinfo code in June 1995. The initial version added a -S option, and interpreted command-line parameters as described in the System V Release 4 documentation.

Portability The Open Group defines one option (-T, to specify the terminal type) and three keywords (init, clear and reset). Most implementations accept the name of a terminal capability together with any parameters that may be needed for that. However, some implementations expect a termcap name, while others expect a terminfo name. All System V Release 4 implementations, as well as those which are designed to be compatible, also recognize a -S option (to tell tput to read data from the standard input), and an additional keyword longname. They also accept command-line parameters, usually distinguishing numeric from string parameters by the form of the parameter, checking for all-numeric characters. That makes it impossible for example to set a function-key label to a string of digits. Using a different approach, ncurses determines the expected type of the parameters with a table of the terminfo capabilities which use string parameters, eliminating the ambiguity.

See also List of Unix commands

References

Further reading Tansley, D. S. W. (2000). "Creating screen output". Linux and UNIX shell programming. Safari Tech Books Online. Addison-Wesley. ISBN 978-0-201-67472-9.

External links

tput – Shell and Utilities Reference, The Single UNIX Specification, Version 5 from The Open Group tput(1) – Linux User Manual – User Commands from Manned.org tput(1) manual page for ncurses AIX BSDI at the Wayback Machine (archived May 13, 2013) SCO HPUX at the Wayback Machine (archived March 4, 2016) SGI Sun Tru64 at the Wayback Machine (archived February 7, 2012) Colours and Cursor Movement With tput in Bash Prompt HOWTO Discover tput on IBM DeveloperWorks

Worked examples

Example 1 — a first encounter with Tput

Start with the simplest possible case. Write down what Tput claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In 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 Tput 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 Tput 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 Tput

In research
Tput appears in 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 Tput 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
Tput is common in secondary-school and first-year university syllabi. It links to neighbouring topics Text mode, Unix SUS2008 utilities, so understanding it makes those chapters shorter.
In everyday life
Look for Tput 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 “Tput” →

How to study Tput in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Tput 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 Tput out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Tput in simple terms?

In computing, tput is a standard Unix operating system command which makes use of terminal capabilities. Depending on the system, tput uses the terminfo or termcap database, as well as looking into the environment for the terminal type.

Why does Tput matter?

Because it connects several 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 Tput?

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 Tput.

Tags

  • Text mode
  • Unix SUS2008 utilities

Keep exploring