2 .\" Copyright 1989 AT&T Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions Copyright (c) 1995, Sun Microsystems, Inc. All Rights Reserved
3 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
4 .\" http://www.opengroup.org/bookstore/.
5 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
6 .\" This notice shall appear on any product containing this material.
7 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
9 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
10 .TH TPUT 1 "Feb 1, 1995"
12 tput \- initialize a terminal or query terminfo database
16 \fBtput\fR [\fB-T\fR \fItype\fR] \fIcapname\fR [\fIparm\fR]...
21 \fBtput\fR \fB-S\fR <<
27 The \fBtput\fR utility uses the \fBterminfo\fR database to make the values of
28 terminal-dependent capabilities and information available to the shell (see
29 \fBsh\fR(1)); to clear, initialize or reset the terminal; or to return the long
30 name of the requested terminal type. \fBtput\fR outputs a string if the
31 capability attribute (\fIcapname\fR) is of type string, or an integer if the
32 attribute is of type integer. If the attribute is of type boolean, \fBtput\fR
33 simply sets the exit status (\fB0\fR for \fBTRUE\fR if the terminal has the
34 capability, \fB1\fR for \fBFALSE\fR if it does not), and produces no output.
35 Before using a value returned on standard output, the user should test the exit
36 status (\fB$?\fR, see \fBsh\fR(1)) to be sure it is \fB0\fR. See the EXIT
41 The following options are supported:
45 \fB\fB-T\fR\fItype\fR \fR
48 Indicates the \fItype\fR of terminal. Normally this option is unnecessary,
49 because the default is taken from the environment variable \fBTERM\fR. If
50 \fB-T\fR is specified, then the shell variables \fBLINES\fR and \fBCOLUMNS\fR
51 and the layer size will not be referenced.
60 Allows more than one capability per invocation of \fBtput\fR. The capabilities
61 must be passed to \fBtput\fR from the standard input instead of from the
62 command line (see the example in the EXAMPLES section). Only one \fIcapname\fR
63 is allowed per line. The \fB-S\fR option changes the meaning of the \fB0\fR and
64 \fB1\fR boolean and string exit statuses (see the EXAMPLES section).
70 The following operands are supported:
77 Indicates the capability attribute from the \fBterminfo\fR database. See
78 \fBterminfo\fR(4) for a complete list of capabilities and the \fIcapname\fR
81 The following strings will be supported as operands by the implementation in
89 Display the clear-screen sequence.
98 If the \fBterminfo\fR database is present and an entry for the user's terminal
99 exists (see \fB-T\fR\fItype\fR, above), the following will occur:
103 if present, the terminal's initialization strings will be output (\fBis1\fR,
104 \fBis2\fR, \fBis3\fR, \fBif\fR, \fBiprog\fR),
109 any delays (for instance, newline) specified in the entry will be set in the
115 tabs expansion will be turned on or off according to the specification in
121 if tabs are not expanded, standard tabs will be set (every 8 spaces). If an
122 entry does not contain the information needed for any of the four above
123 activities, that activity will silently be skipped.
133 Instead of putting out initialization strings, the terminal's reset strings
134 will be output if present (\fBrs1\fR, \fBrs2\fR, \fBrs3\fR, \fBrf\fR). If the
135 reset strings are not present, but initialization strings are, the
136 initialization strings will be output. Otherwise, \fBreset\fR acts identically
143 \fB\fBlongname\fR \fR
146 If the \fBterminfo\fR database is present and an entry for the user's terminal
147 exists (see \fB-T\fR\fItype\fR above), then the long name of the terminal will
148 be put out. The long name is the last name in the first line of the terminal's
149 description in the \fBterminfo\fR database (see \fBterm\fR(5)).
160 If the attribute is a string that takes parameters, the argument \fIparm\fR
161 will be instantiated into the string. An all numeric argument will be passed to
162 the attribute as a number.
167 \fBExample 1 \fRInitializing the terminal according to TERM
170 This example initializes the terminal according to the type of terminal in the
171 environment variable \fBTERM\fR. This command should be included in
172 everyone's .profile after the environment variable \fBTERM\fR has been exported, as
173 illustrated on the \fBprofile\fR(4) manual page.
178 example% \fBtput init\fR
184 \fBExample 2 \fRResetting a terminal
187 This example resets an AT&T 5620 terminal, overriding the type of terminal in
188 the environment variable \fBTERM\fR:
193 example% \fBtput -T5620 reset\fR
199 \fBExample 3 \fRMoving the cursor
202 The following example sends the sequence to move the cursor to row \fB0\fR,
203 column \fB0\fR (the upper left corner of the screen, usually known as the
204 "home" cursor position).
209 example% \fBtput cup 0 0\fR
216 This next example sends the sequence to move the cursor to row \fB23\fR, column
222 example% \fBtput cup 23 4\fR
228 \fBExample 4 \fREchoing the clear-screen sequence
231 This example echos the clear-screen sequence for the current terminal.
236 example% \fBtput clear\fR
242 \fBExample 5 \fRPrinting the number of columns
245 This command prints the number of columns for the current terminal.
250 example% \fBtput cols\fR
257 The following command prints the number of columns for the 450 terminal.
262 example% \fBtput -T450 cols\fR
268 \fBExample 6 \fRSetting shell variables
271 This example sets the shell variables \fBbold\fR, to begin stand-out mode
272 sequence, and \fBoffbold\fR, to end standout mode sequence, for the current
273 terminal. This might be followed by a prompt:
278 \fBecho "${bold}Please type in your name: ${offbold}\ec"\fR
279 example% \fBbold='tput smso'\fR
280 example% \fBoffbold='tput rmso'\fR
286 \fBExample 7 \fRSetting the exit status
289 This example sets the exit status to indicate if the current terminal is a
295 example% \fBtput hc\fR
301 \fBExample 8 \fRPrinting the long name from terminfo
304 This command prints the long name from the \fBterminfo\fR database for the type
305 of terminal specified in the environment variable \fBTERM\fR.
310 example% \fBtput longname\fR
316 \fBExample 9 \fRProcessing several capabilities with one invocation
319 This example shows \fBtput\fR processing several capabilities in one
320 invocation. This example clears the screen, moves the cursor to position
321 \fB10\fR, \fB10\fR and turns on \fBbold\fR (extra bright) mode. The list is
322 terminated by an exclamation mark (\fB!\fR) on a line by itself.
327 example% \fBtput -S <<!
336 .SH ENVIRONMENT VARIABLES
339 See \fBenviron\fR(5) for descriptions of the following environment variables
340 that affect the execution of \fBtput\fR: \fBLANG\fR, \fBLC_ALL\fR,
341 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
348 Determine the terminal type. If this variable is unset or null, and if the
349 \fB-T\fR option is not specified, an unspecified default terminal type will be
356 The following exit values are returned:
367 If \fIcapname\fR is of type boolean and \fB-S\fR is not specified, indicates
374 If \fIcapname\fR is of type string and \fB-S\fR is not specified, indicates
375 \fIcapname\fR is defined for this terminal type.
381 If \fIcapname\fR is of type boolean or string and \fB-S\fR is specified,
382 indicates that all lines were successful.
388 \fIcapname\fR is of type integer.
394 The requested string was written successfully.
408 If \fIcapname\fR is of type boolean and \fB-S\fR is not specified, indicates
415 If \fIcapname\fR is of type string and \fB-S\fR is not specified, indicates
416 that \fIcapname\fR is not defined for this terminal type.
435 No information is available about the specified terminal type.
444 The specified operand is invalid.
462 \fIcapname\fR is a numeric variable that is not specified in the \fBterminfo\fR
463 database. For instance, \fBtput\fR \fB-T450\fR lines and \fBtput\fR
471 \fB\fB/usr/include/curses.h\fR \fR
475 \fBcurses\fR(3CURSES) header
481 \fB\fB/usr/include/term.h\fR \fR
485 \fBterminfo\fR header
491 \fB\fB/usr/lib/tabset/*\fR \fR
495 Tab settings for some terminals, in a format appropriate to be output to the
496 terminal (escape sequences that set margins and tabs). For more information,
497 see the "Tabs and Initialization" section of \fBterminfo\fR(4)
503 \fB\fB/usr/share/lib/terminfo/?/*\fR \fR
507 compiled terminal description database
513 See \fBattributes\fR(5) for descriptions of the following attributes:
521 ATTRIBUTE TYPE ATTRIBUTE VALUE
523 Interface Stability Standard
529 \fBclear\fR(1), \fBsh\fR(1), \fBstty\fR(1), \fBtabs\fR(1),
530 \fBcurses\fR(3CURSES), \fBprofile\fR(4), \fBterminfo\fR(4),
531 \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5), \fBterm\fR(5)