1TPUT(P) POSIX Programmer's Manual TPUT(P)
2
3
4
6 tput - change terminal characteristics
7
9 tput [-T type] operand...
10
12 The tput utility shall display terminal-dependent information. The
13 manner in which this information is retrieved is unspecified. The
14 information displayed shall clear the terminal screen, initialize the
15 user's terminal, or reset the user's terminal, depending on the operand
16 given. The exact consequences of displaying this information are
17 unspecified.
18
20 The tput utility shall conform to the Base Definitions volume of
21 IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
22
23 The following option shall be supported:
24
25 -T type
26 Indicate the type of terminal. If this option is not supplied
27 and the TERM variable is unset or null, an unspecified default
28 terminal type shall be used. The setting of type shall take
29 precedence over the value in TERM .
30
31
33 The following strings shall be supported as operands by the implementa‐
34 tion in the POSIX locale:
35
36 clear Display the clear-screen sequence.
37
38 init Display the sequence that initializes the user's terminal in an
39 implementation-defined manner.
40
41 reset Display the sequence that resets the user's terminal in an
42 implementation-defined manner.
43
44
45 If a terminal does not support any of the operations described by these
46 operands, this shall not be considered an error condition.
47
49 Not used.
50
52 None.
53
55 The following environment variables shall affect the execution of tput:
56
57 LANG Provide a default value for the internationalization variables
58 that are unset or null. (See the Base Definitions volume of
59 IEEE Std 1003.1-2001, Section 8.2, Internationalization Vari‐
60 ables for the precedence of internationalization variables used
61 to determine the values of locale categories.)
62
63 LC_ALL If set to a non-empty string value, override the values of all
64 the other internationalization variables.
65
66 LC_CTYPE
67 Determine the locale for the interpretation of sequences of
68 bytes of text data as characters (for example, single-byte as
69 opposed to multi-byte characters in arguments).
70
71 LC_MESSAGES
72 Determine the locale that should be used to affect the format
73 and contents of diagnostic messages written to standard error.
74
75 NLSPATH
76 Determine the location of message catalogs for the processing of
77 LC_MESSAGES .
78
79 TERM Determine the terminal type. If this variable is unset or null,
80 and if the -T option is not specified, an unspecified default
81 terminal type shall be used.
82
83
85 Default.
86
88 If standard output is a terminal device, it may be used for writing the
89 appropriate sequence to clear the screen or reset or initialize the
90 terminal. If standard output is not a terminal device, undefined
91 results occur.
92
94 The standard error shall be used only for diagnostic messages.
95
97 None.
98
100 None.
101
103 The following exit values shall be returned:
104
105 0 The requested string was written successfully.
106
107 1 Unspecified.
108
109 2 Usage error.
110
111 3 No information is available about the specified terminal type.
112
113 4 The specified operand is invalid.
114
115 >4 An error occurred.
116
117
119 If one of the operands is not available for the terminal, tput contin‐
120 ues processing the remaining operands.
121
122 The following sections are informative.
123
125 The difference between resetting and initializing a terminal is left
126 unspecified, as they vary greatly based on hardware types. In general,
127 resetting is a more severe action.
128
129 Some terminals use control characters to perform the stated functions,
130 and on such terminals it might make sense to use tput to store the ini‐
131 tialization strings in a file or environment variable for later use.
132 However, because other terminals might rely on system calls to do this
133 work, the standard output cannot be used in a portable manner, such as
134 the following non-portable constructs:
135
136
137 ClearVar=`tput clear`
138 tput reset | mailx -s "Wake Up" ddg
139
141 1. Initialize the terminal according to the type of terminal in the
142 environmental variable TERM . This command can be included in a
143 .profile file.
144
145
146 tput init
147
148 2. Reset a 450 terminal.
149
150
151 tput -T 450 reset
152
154 The list of operands was reduced to a minimum for the following rea‐
155 sons:
156
157 * The only features chosen were those that were likely to be used by
158 human users interacting with a terminal.
159
160 * Specifying the full terminfo set was not considered desirable, but
161 the standard developers did not want to select among operands.
162
163 * This volume of IEEE Std 1003.1-2001 does not attempt to provide
164 applications with sophisticated terminal handling capabilities, as
165 that falls outside of its assigned scope and intersects with the
166 responsibilities of other standards bodies.
167
168 The difference between resetting and initializing a terminal is left
169 unspecified as this varies greatly based on hardware types. In gen‐
170 eral, resetting is a more severe action.
171
172 The exit status of 1 is historically reserved for finding out if a
173 Boolean operand is not set. Although the operands were reduced to a
174 minimum, the exit status of 1 should still be reserved for the Boolean
175 operands, for those sites that wish to support them.
176
178 None.
179
181 stty , tabs
182
184 Portions of this text are reprinted and reproduced in electronic form
185 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
186 -- Portable Operating System Interface (POSIX), The Open Group Base
187 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
188 Electrical and Electronics Engineers, Inc and The Open Group. In the
189 event of any discrepancy between this version and the original IEEE and
190 The Open Group Standard, the original IEEE and The Open Group Standard
191 is the referee document. The original Standard can be obtained online
192 at http://www.opengroup.org/unix/online.html .
193
194
195
196IEEE/The Open Group 2003 TPUT(P)