TOOL » LINUX » PACKAGE

Tput

Usage

Make terminal-dependent capabilities and information available to the shell.

shell
tput CAPNAME
Capability nameDescription
boldOutput bold text.
sgr0Output normal text.
setaf [0-9]+Set foreground color.
setab [0-9]+Set background color.
linesNumber of lines in the terminal.
colsNumber of columns in the terminal.

Color table

ColorNormalBright
Black08
Red19
Green210
Yellow311
Blue412
Magenta513
Cyan614
White715

Example

Bold & normal:

shell
echo "$(tput bold)This text is bold$(tput sgr0). This text is normal."

Colored:

shell
echo "$(tput setaf 1)red text$(tput sgr0) $(tput setaf 2)green text$(tput sgr0)"