The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


tput - change terminal characteristics


tput [-T type] operand...


The tput utility displays terminal-dependent information. The manner in which this information is retrieved is unspecified. The information displayed will clear the terminal screen, initialise the user's terminal or reset the user's terminal, depending on the operand given. The exact consequences of displaying this information are unspecified.


The tput utility supports the XBD specification, Utility Syntax Guidelines  .

The following option is supported:

-T type
Indicate the type of terminal. If this option is not supplied and the TERM variable is unset or null, an unspecified default terminal type will be used. The setting of type will take precedence over the value in TERM .


The following strings will be supported as operands by the implementation in the POSIX locale:
Display the clear-screen sequence.
Display the sequence that will initialise the user's terminal in an implementation-dependent manner.
Display the sequence that will reset the user's terminal in an implementation-dependent manner.

If a terminal does not support any of the operations described by these operands, this will not be considered an error condition.


Not used.




The following environment variables affect the execution of tput:
Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
If set to a non-empty string value, override the values of all the other internationalisation variables.
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
Determine the location of message catalogues for the processing of LC_MESSAGES .
Determine the terminal type. If this variable is unset or null, and if the -T option is not specified, an unspecified default terminal type will be used.




If standard output is a terminal device, it may be used for writing the appropriate sequence to clear the screen or reset or initialise the terminal. If standard output is not a terminal device, undefined results occur.


Used only for diagnostic messages.






The following exit values are returned:
The requested string was written successfully.
Usage error.
No information is available about the specified terminal type.
The specified operand is invalid.
An error occurred.


If one of the operands is not available for the terminal, tput continues processing the remaining operands.


The difference between resetting and initialising a terminal is left unspecified, as they vary greatly based on hardware types. In general, resetting is a more severe action.

Some terminals use control characters to perform the stated functions, and on such terminals it might make sense to use tput to store the initialisation strings in a file or environment variable for later use. However, because other terminals might rely on system calls to do this work, the standard output cannot be used in a portable manner, such as the following non-portable constructs:

ClearVar=`tput clear`
tput reset | mailx -s "Wake Up" ddg


  1. Initialise the terminal according to the type of terminal in the environmental variable TERM. This command can be included in a .profile file.
    tput init

  2. Reset a 450 terminal.
    tput -T 450 reset




stty, tabs.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]