tput — Change characteristics of terminals

Format

tput [–T type] capname[parm1…parm9]

tput [–T type] –S

Description

tput lets you change your terminal's characteristics. The capname arguments indicate how you want to change the characteristics. Possible capnames are:
clear
Clears the screen
init
Initializes your terminal
reset
Resets your terminal

tput does its work by outputting appropriate character sequences to the standard output. These character sequences are terminal-specific.

Usually, tput looks for an environment variable named TERM. If TERM exists, tput uses its value as the terminal type. If it doesn't exist, tput assumes a default terminal type.

Options

–T type
Identifies the type of your terminal. This overrides the TERM environment variable.
The second format of this command provides extensions for XPG/System V. This format of tput accepts an additional option, –S.
–S
Takes input from standard input, one capability/capname per line. A blank line terminates input.
An additional capname is supported for System V:
longname
Returns the long descriptive name of the terminal.

An extension to provide System V capabilities allows capname to be a capability from the terminfo database. If the capability requires arguments, they appear after the capname option.

Localization

tput uses the following localization environment variables:
  • LANG
  • LC_ALL
  • LC_CTYPE
  • LC_MESSAGES
  • NLSPATH

See Localization for more information.

Environment variables

tput uses the following environment variables:
TERM
Contains the current terminal type.
TERMINFO
Can be used to override the default database.

Exit values

0
tput successfully wrote an appropriate character sequence to change the terminal's characteristics, or a Boolean terminfo variable is true.
1
A Boolean terminfo variable is false.
2
Failure that generated a usage message such as:
  • capname was not a recognized keyword
  • You specified an incorrect command-line option
3
tput has no information about the terminal type given by –T or TERM.
4
The requested capname cannot be performed on your type of terminal.
>4
An error occurred.

Portability

POSIX.2 User Portability Extension, UNIX systemsUNIX systems.

Related information

stty, tabs