Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > T


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


tput — query terminfo database


tput [-T type] capname...

tput [-T type] capname [parms...]

tput -S


The tput command uses the terminfo database to make terminal-dependent capabilities and information available to the shell (see terminfo(4)). The tput command outputs a string if the attribute (capname) is of type string, or an integer if the attribute is of type integer. If the attribute is of type boolean, tput simply sets the exit code (0 for TRUE, 1 for FALSE), and produces no output.

Command-line Arguments

The tput command recognizes the following command-line arguments:


Indicates the type of terminal. Normally this flag is unnecessary because the default is taken from the environment variable TERM.


Indicates the attribute from the terminfo database. See terminfo(4). In addition, the following capnames are supported:


Echo the clear-screen sequence for the current terminal.


Echo the initialize sequence for the current terminal.


Echo the sequence that will reset the current terminal.


If the capname takes optional numeric parameters, the parms will be placed in the string output by tput.


The capnames are read from stdin and multiple capnames are allowed. Only one capname is allowed per line when reading from stdin.


Environment Variables

LC_ALL determines the locale to use. This overrides settings of other environment variables.

LC_MESSAGES determines the language to use for messages.

TERM determines the terminal type if the -T option is not specified.


Echo clear-screen sequence for the current terminal.

tput clear

Print the number of columns for the current terminal.

tput cols

Print the number of columns for the 70092 terminal.

tput -T70092 cols

Set shell variable bold to stand-out-mode sequence for current terminal.

bold=`tput smso`

This might be followed by a prompt:

  • echo "${bold}Please type in your name: \c"

Set exit code to indicate if current terminal is a hard copy terminal.

tput hc

Clear the screen, move the cursor to line 10, column 20 and turn on bold.

tput -S <<EOF clear cup 10 20 bold EOF


If capname is of type boolean, then the exit code is set to 0 for true and 1 for false.

If capname is not of type boolean and tput fails, an error message is printed, and exit code is set to one of the following depending on the failure:


The capability name is of type integer and does not exist.


Usage error.


Unknown terminal type.


Unknown capability name.


An error occurred.

If the exit code is 0, a -1 is printed if a capability name of type integer is requested for a terminal that has no entry for that capability name in the terminfo database (such as tput -Thp70092 vt).



Terminfo data base


Definition files



tput: SVID2, SVID3, XPG4

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.