Here are some common tput commands that you can use to manipulate terminal display and behavior:
Clear the Screen:
tput clearSet 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 boldUnderlined Text:
tput smul # Start underlining tput rmul # Stop underliningMove 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 elReset Terminal Attributes:
tput sgr0This command resets all attributes to their defaults.
Hide Cursor:
tput civisShow Cursor:
tput cnormEnable/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!
