Tput

Standard Unix operating system command


title: "Tput" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["unix-sus2008-utilities", "text-mode"] description: "Standard Unix operating system command" topic_path: "technology/operating-systems" source: "https://en.wikipedia.org/wiki/Tput" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0

::summary Standard Unix operating system command ::

::data[format=table title="Infobox software"]

FieldValue
nametput
released
operating systemUnix and Unix-like
platformCross-platform
genreCommand
::

| name = tput | logo = | screenshot = | screenshot size = | caption = | author = | developer = | released = | latest release version = | latest release date = | operating system = Unix and Unix-like | platform = Cross-platform | genre = Command | license = | website = 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.{{cite web |url=https://groups.google.com/forum/embed/#!topic/mod.sources/G1VegA0Aa_w |title=Public-domain tput(1) program |first=Badri |last=Lokanathan |date=1986-08-28 |access-date=2008-04-22 |url=https://groups.google.com/forum/embed/#!topic/mod.sources/Eq3EPGxuYrI |title=Public-domain TPUT (corrected implementation) |first=Badri |last=Lokanathan |date=1986-09-19 |access-date=2008-04-22

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.{{Cite book |url=https://books.google.com/books?id=GsUMLqtYI1UC&q=tput |title=Termcap and terminfo |last1=Strang |first1=John |last2=Mui |first2=Linda |last3=O'Reilly |first3=Tim |publisher=O'Reilly |year=1988 |page=56–57 |isbn=0-937175-22-6

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).{{cite web |url=http://minnie.tuhs.org/Unix_History/4bsd |title=3BSD/4BSD versions |date=2000-06-25 |publisher=The Unix Heritage Society |access-date=2008-04-20 |url=http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/tput/tput.c |title=CVS log for src/usr.bin/tput/tput.c |date=May 27, 1994

Ross Ridge's mytinfo package in 1992{{cite newsgroup |url=https://groups.google.com/forum/#!topic/comp.sources.unix/tC8cAf6ZHjM |author=Ross Ridge |title=mytinfo - a replacement for terminfo and termcap |newsgroup=comp.sources.unix |date=December 27, 1992

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.

References

::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::

unix-sus2008-utilitiestext-mode