21.1. tput

Before using tput you need to initialize your terminal using the tput command either inside your scripts or on the command line.

$ tput init

Tput can produce three different kinds of output: string, numeric and Boolean (true/false). We will cover the most useful capabilities of each.

21.1.1. String output

Here are the most common strings:

Name Meaning
bel Ring the bell
blink Blinking mode
bold Double intensity
civis Hide the cursor
clear Clear the screen
cnorm Unhide the cursor
cup Move cursor to x, y position on screen
el Clear to the end of line
ell Clear to the beginning of line
smso Start stand out mode
rmso End stand out mode
smul Start underline mode
rmul End underline mode
sc Save current cursor position
rc Restore cursor ...

Get Linux and Unix Shell Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.