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
11
13 tput — change terminal characteristics
14
16 tput [−T type] operand...
17
19 The tput utility shall display terminal-dependent information. The man‐
20 ner in which this information is retrieved is unspecified. The informa‐
21 tion displayed shall clear the terminal screen, initialize the user's
22 terminal, or reset the user's terminal, depending on the operand given.
23 The exact consequences of displaying this information are unspecified.
24
26 The tput utility shall conform to the Base Definitions volume of
27 POSIX.1‐2008, Section 12.2, Utility Syntax Guidelines.
28
29 The following option shall be supported:
30
31 −T type Indicate the type of terminal. If this option is not supplied
32 and the TERM variable is unset or null, an unspecified
33 default terminal type shall be used. The setting of type
34 shall take precedence over the value in TERM.
35
37 The following strings shall be supported as operands by the implementa‐
38 tion in the POSIX locale:
39
40 clear Display the clear-screen sequence.
41
42 init Display the sequence that initializes the user's terminal in
43 an implementation-defined manner.
44
45 reset Display the sequence that resets the user's terminal in an
46 implementation-defined manner.
47
48 If a terminal does not support any of the operations described by these
49 operands, this shall not be considered an error condition.
50
52 Not used.
53
55 None.
56
58 The following environment variables shall affect the execution of tput:
59
60 LANG Provide a default value for the internationalization vari‐
61 ables that are unset or null. (See the Base Definitions vol‐
62 ume of POSIX.1‐2008, Section 8.2, Internationalization Vari‐
63 ables for the precedence of internationalization variables
64 used to determine the values of locale categories.)
65
66 LC_ALL If set to a non-empty string value, override the values of
67 all the other internationalization variables.
68
69 LC_CTYPE Determine the locale for the interpretation of sequences of
70 bytes of text data as characters (for example, single-byte as
71 opposed to multi-byte characters in arguments).
72
73 LC_MESSAGES
74 Determine the locale that should be used to affect the format
75 and contents of diagnostic messages written to standard
76 error.
77
78 NLSPATH Determine the location of message catalogs for the processing
79 of LC_MESSAGES.
80
81 TERM Determine the terminal type. If this variable is unset or
82 null, and if the −T option is not specified, an unspecified
83 default terminal type shall be used.
84
86 Default.
87
89 If standard output is a terminal device, it may be used for writing the
90 appropriate sequence to clear the screen or reset or initialize the
91 terminal. If standard output is not a terminal device, undefined
92 results occur.
93
95 The standard error shall be used only for diagnostic messages.
96
98 None.
99
101 None.
102
104 The following exit values shall be returned:
105
106 0 The requested string was written successfully.
107
108 1 Unspecified.
109
110 2 Usage error.
111
112 3 No information is available about the specified terminal type.
113
114 4 The specified operand is invalid.
115
116 >4 An error occurred.
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 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 tput init
145
146 2. Reset a 450 terminal.
147
148 tput −T 450 reset
149
151 The list of operands was reduced to a minimum for the following rea‐
152 sons:
153
154 * The only features chosen were those that were likely to be used by
155 human users interacting with a terminal.
156
157 * Specifying the full terminfo set was not considered desirable, but
158 the standard developers did not want to select among operands.
159
160 * This volume of POSIX.1‐2008 does not attempt to provide applica‐
161 tions with sophisticated terminal handling capabilities, as that
162 falls outside of its assigned scope and intersects with the respon‐
163 sibilities of other standards bodies.
164
165 The difference between resetting and initializing a terminal is left
166 unspecified as this varies greatly based on hardware types. In general,
167 resetting is a more severe action.
168
169 The exit status of 1 is historically reserved for finding out if a
170 Boolean operand is not set. Although the operands were reduced to a
171 minimum, the exit status of 1 should still be reserved for the Boolean
172 operands, for those sites that wish to support them.
173
175 None.
176
178 stty, tabs
179
180 The Base Definitions volume of POSIX.1‐2008, Chapter 8, Environment
181 Variables, Section 12.2, Utility Syntax Guidelines
182
184 Portions of this text are reprinted and reproduced in electronic form
185 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
186 -- Portable Operating System Interface (POSIX), The Open Group Base
187 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
188 cal and Electronics Engineers, Inc and The Open Group. (This is
189 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
190 event of any discrepancy between this version and the original IEEE and
191 The Open Group Standard, the original IEEE and The Open Group Standard
192 is the referee document. The original Standard can be obtained online
193 at http://www.unix.org/online.html .
194
195 Any typographical or formatting errors that appear in this page are
196 most likely to have been introduced during the conversion of the source
197 files to man page format. To report such errors, see https://www.ker‐
198 nel.org/doc/man-pages/reporting_bugs.html .
199
200
201
202IEEE/The Open Group 2013 TPUT(1P)