Here are some common tput commands that you can use to manipulate terminal display and behavior:
-
Clear the Screen:
tput clear -
Set Text Color:
-
Set foreground color (text color):
tput setaf [color_number]For example,
tput setaf 1sets the text color to red. -
Set background color:
tput setab [color_number]For example,
tput setab 4sets the background color to blue.
-
-
Bold Text:
tput bold -
Underlined Text:
tput smul # Start underlining tput rmul # Stop underlining -
Move the Cursor:
tput cup [row] [column]For example,
tput cup 5 10moves the cursor to row 5, column 10. -
Clear to End of Line:
tput el -
Reset Terminal Attributes:
tput sgr0This command resets all attributes to their defaults.
-
Hide Cursor:
tput civis -
Show Cursor:
tput cnorm -
Enable/Disable Line Wrapping:
- Disable line wrapping:
tput rmam - Enable line wrapping:
tput smam
- Disable line wrapping:
These commands can be combined in scripts to create visually appealing terminal applications or to enhance user interaction. Feel free to experiment with them to see how they affect your terminal!
