Tput
Overview
Tput is a useful tool to create control characters to customize the terminal font.
tput bold # Start bold text
tput smul # Start underlined text
tput rmul # End underlined text
tput rev # Start reverse video
tput blink # Start blinking text
tput invis # Start invisible text
tput smso # Start "standout" mode
tput rmso # End "standout" mode
tput sgr0 # Turn off all attributes
tput setaf <value> # Set foreground color
tput setab <value> # Set background color
Clear screen:
tput reset
Some examples follow
Print available colors
$ tput colors
256
$ for c in {1..256}; do tput setaf $c; echo "Color $c"; done
Set and clear a color
# set to red
tput setaf 1
# clear
tput sgr0
Styles
# set to bold
tput bold
# clear
tput sgr0
Store control char in variable
REDBOLD=$(tput setaf 1)$(tput bold)
PLAIN=$(tput sgr0)
echo "This is a ${REDBOLD}red bold${PLAIN} word"