While writing command-line shell scripts, we will often need to heavily manipulate information about the current terminal, such as number of columns, rows, cursor positions, masked password fields, and so on. This recipe helps to learn about collecting and manipulating terminal settings.
stty are utilities that can be used for terminal manipulations. Let's see how to use them to perform different tasks.
Get number of columns and rows in a terminal as follows:
tput cols tput lines
In order to print the current terminal name, use:
For moving the cursor to a position 100,100 you can enter:
tput cup 100 100
Set the background color for terminal as follows:
tput setb ...