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:
- clear
- Display the clear-screen sequence.
- init
- Display the sequence that will initialise the user's terminal in an implementation-dependent manner.
- reset
- 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.
None.
The following environment variables affect the execution of tput:
- LANG
- 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.
- LC_ALL
- If set to a non-empty string value, override the values of all the other internationalisation variables.
- LC_CTYPE
- 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).
- LC_MESSAGES
- Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
- NLSPATH
- Determine the location of message catalogues for the processing of LC_MESSAGES .
- TERM
- 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.
Default.
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.
None.
None.
The following exit values are returned:
- 0
- The requested string was written successfully.
- 1
- Unspecified.
- 2
- Usage error.
- 3
- No information is available about the specified terminal type.
- 4
- The specified operand is invalid.
- >4
- 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
- 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
- Reset a 450 terminal.
tput -T 450 reset
None.
stty, tabs.