tput(1) — Commands
NAME
tput − Queries the terminal information database
SYNOPSIS
tput [-T type] capability_name ...
The tput command uses the terminfo database to make terminal-dependent information available to the shell.
DESCRIPTION
The capability_name argument indicates the attribute from a terminfo file. The output of tput is a string if the attribute capability_name is of the type string, or an integer if the attribute is of the type integer. If capability_name is of the type Boolean, tput sets the exit value (0 for TRUE, 1 for FALSE) and produces no other output. For more information, see terminfo(4).
The following are among the strings that can be entered as the capability_name argument:
clearDisplays the clear-screen sequence.
initDisplays the sequence that initializes the user’s terminal.
longname
Displays the terminfo long terminal name.
resetDisplays the sequence that resets the user’s terminal.
FLAGS
-T typeSpecifies the type of terminal. By default, the value of type is taken from the environment variable $TERM.
EXAMPLES
1.To echo the clear-screen sequence for the current terminal, enter:
tput clear
2.To display the number of columns for the current terminal, enter:
tput cols
3.To set and unset the highlight-mode sequences for the current terminal, enter:
bold=‘tput smso‘
unbold=‘tput rmso‘
If you are using csh, the argument to the set and unset sequence must be enclosed in double quotes as follows:
set bold="‘tput smso‘"
set unbold="‘tput rmso‘"
Both of these examples can be followed by a prompt:
echo "${bold}Please type in your name:${unbold} \c"
4.To set the exit value to indicate if the current terminal is a hard-copy terminal, enter:
tput hc
If you are using csh, the exit value for the preceding example is stored in $status; otherwise, the exit value is stored in $?.
EXIT VALUES
0FALSE Boolean value or the requested string was written successfully.
1TRUE Boolean value.
2Usage error.
3No information is available about the specified terminal type.
4Capability is invalid.
>4An error occurred.
FILES
/usr/share/lib/terminfo/?/∗
Terminal information database.
/usr/include/term.hDefinition files.
/usr/include/curses.hcurses library definition file.
RELATED INFORMATION
Commands: stty(1).
Files: terminfo(4).