tput

Query and initialize terminal capabilities for scripting.

low risk

interactive breakdown — edit the command and press Explain
$ 
What it does

tput queries the terminal database (terminfo) to retrieve capabilities like terminal dimensions, cursor control codes, and color codes. Used in scripts to produce colored output, move the cursor, and check terminal dimensions portably.

Examples
tput cols && tput linesGet terminal width and height · explain & risk-check →
echo "$(tput setaf 2)SUCCESS$(tput sgr0): Deploy complete"Green colored output in scripts · explain & risk-check →
tput civisHide cursor (restore with tput cnorm) · explain & risk-check →
tput clearClear screen (same as clear command) · explain & risk-check →
RED=$(tput setaf 1); GREEN=$(tput setaf 2); NC=$(tput sgr0)Define color variables for use throughout a script · explain & risk-check →
Pro tip

Define colors with tput in scripts: `RED=$(tput setaf 1); NC=$(tput sgr0); echo "${RED}ERROR${NC}: msg"` — more portable than hardcoding ANSI escape codes.

Related
stty printf echo
Open the full explainer →More in Shell & Scripting

Reference text is hand-written and may be incomplete — check man tput for your version. Test destructive commands on a non-production system first.