O'Reilly logo

Linux and Unix Shell Programming by David Tansley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required