tput command examples
tput, reset – initialize a terminal or query terminfo database
tput init
Initialize the terminal according to the type of terminal in the environmental variable TERM. This command should be included in everyone’s .profile after the environmental variable TERM has been exported, as illustrated on the profile(5) manual page.
tput -T5620 reset
Reset an AT&T 5620 terminal, overriding the type of terminal in the environmental variable TERM.
tput cup 0 0
Send the sequence to move the cursor to row 0, column 0 (the upper left corner of the screen, usually known as the “home” cursor position).
tput clear
Echo the clear-screen sequence for the current terminal.
tput cols
Print the number of columns for the current terminal.
tput -T450 cols
Print the number of columns for the 450 terminal.
bold=`tput smso` offbold=`tput rmso`
Set the shell variables bold, to begin stand-out mode sequence, and offbold, to end standout mode sequence, for the current terminal. This might be followed by a prompt: echo “${bold}Please type in your name: ${offbold}\c”
tput hc
Set exit code to indicate if the current terminal is a hard copy terminal.
tput cup 23 4
Send the sequence to move the cursor to row 23, column 4.
tput cup
Send the terminfo string for cursor-movement, with no parameters substituted.
tput longname
Print the long name from the terminfo database for the type of terminal specified in the environmental variable TERM.
tput -S < clear > cup 10 10 > bold > !
This example shows tput processing several capabilities in one invocation. It clears the screen, moves the cursor to position 10, 10 and turns on bold (extra bright) mode. The list is terminated by an exclamation mark (!) on a line by itself.