1TPUT(1P) POSIX Programmer's Manual TPUT(1P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 tput — change terminal characteristics
13
15 tput [-T type] operand...
16
18 The tput utility shall display terminal-dependent information. The man‐
19 ner in which this information is retrieved is unspecified. The informa‐
20 tion displayed shall clear the terminal screen, initialize the user's
21 terminal, or reset the user's terminal, depending on the operand given.
22 The exact consequences of displaying this information are unspecified.
23
25 The tput utility shall conform to the Base Definitions volume of
26 POSIX.1‐2017, Section 12.2, Utility Syntax Guidelines.
27
28 The following option shall be supported:
29
30 -T type Indicate the type of terminal. If this option is not supplied
31 and the TERM variable is unset or null, an unspecified
32 default terminal type shall be used. The setting of type
33 shall take precedence over the value in TERM.
34
36 The following strings shall be supported as operands by the implementa‐
37 tion in the POSIX locale:
38
39 clear Display the clear-screen sequence.
40
41 init Display the sequence that initializes the user's terminal in
42 an implementation-defined manner.
43
44 reset Display the sequence that resets the user's terminal in an
45 implementation-defined manner.
46
47 If a terminal does not support any of the operations described by these
48 operands, this shall not be considered an error condition.
49
51 Not used.
52
54 None.
55
57 The following environment variables shall affect the execution of tput:
58
59 LANG Provide a default value for the internationalization vari‐
60 ables that are unset or null. (See the Base Definitions vol‐
61 ume of POSIX.1‐2017, Section 8.2, Internationalization Vari‐
62 ables for the precedence of internationalization variables
63 used to determine the values of locale categories.)
64
65 LC_ALL If set to a non-empty string value, override the values of
66 all the other internationalization variables.
67
68 LC_CTYPE Determine the locale for the interpretation of sequences of
69 bytes of text data as characters (for example, single-byte as
70 opposed to multi-byte characters in arguments).
71
72 LC_MESSAGES
73 Determine the locale that should be used to affect the format
74 and contents of diagnostic messages written to standard
75 error.
76
77 NLSPATH Determine the location of message catalogs for the processing
78 of LC_MESSAGES.
79
80 TERM Determine the terminal type. If this variable is unset or
81 null, and if the -T option is not specified, an unspecified
82 default terminal type shall be used.
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
118 If one of the operands is not available for the terminal, tput contin‐
119 ues processing the remaining operands.
120
121 The following sections are informative.
122
124 The difference between resetting and initializing a terminal is left
125 unspecified, as they vary greatly based on hardware types. In general,
126 resetting is a more severe action.
127
128 Some terminals use control characters to perform the stated functions,
129 and on such terminals it might make sense to use tput to store the ini‐
130 tialization strings in a file or environment variable for later use.
131 However, because other terminals might rely on system calls to do this
132 work, the standard output cannot be used in a portable manner, such as
133 the following non-portable constructs:
134
135
136 ClearVar=`tput clear`
137 tput reset | mailx -s "Wake Up" ddg
138
140 1. Initialize the terminal according to the type of terminal in the
141 environmental variable TERM. This command can be included in a
142 .profile file.
143
144
145 tput init
146
147 2. Reset a 450 terminal.
148
149
150 tput -T 450 reset
151
153 The list of operands was reduced to a minimum for the following rea‐
154 sons:
155
156 * The only features chosen were those that were likely to be used by
157 human users interacting with a terminal.
158
159 * Specifying the full terminfo set was not considered desirable, but
160 the standard developers did not want to select among operands.
161
162 * This volume of POSIX.1‐2017 does not attempt to provide applica‐
163 tions with sophisticated terminal handling capabilities, as that
164 falls outside of its assigned scope and intersects with the respon‐
165 sibilities of other standards bodies.
166
167 The difference between resetting and initializing a terminal is left
168 unspecified as this varies greatly based on hardware types. In general,
169 resetting is a more severe action.
170
171 The exit status of 1 is historically reserved for finding out if a
172 Boolean operand is not set. Although the operands were reduced to a
173 minimum, the exit status of 1 should still be reserved for the Boolean
174 operands, for those sites that wish to support them.
175
177 None.
178
180 stty, tabs
181
182 The Base Definitions volume of POSIX.1‐2017, Chapter 8, Environment
183 Variables, Section 12.2, Utility Syntax Guidelines
184
186 Portions of this text are reprinted and reproduced in electronic form
187 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
188 table Operating System Interface (POSIX), The Open Group Base Specifi‐
189 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
190 Electrical and Electronics Engineers, Inc and The Open Group. In the
191 event of any discrepancy between this version and the original IEEE and
192 The Open Group Standard, the original IEEE and The Open Group Standard
193 is the referee document. The original Standard can be obtained online
194 at http://www.opengroup.org/unix/online.html .
195
196 Any typographical or formatting errors that appear in this page are
197 most likely to have been introduced during the conversion of the source
198 files to man page format. To report such errors, see https://www.ker‐
199 nel.org/doc/man-pages/reporting_bugs.html .
200
201
202
203IEEE/The Open Group 2017 TPUT(1P)