Tput
From Christoph's Personal Wiki
This article will explore the tput command in Linux. It is a standard Unix operating system command, which is used to set terminal features.
Depending on the system, tput
uses the terminfo or termcap database, as well as looking into the environment for the terminal type.
Usage
Action | Parameters |
---|---|
Set background color | tput setab [1-7] |
Set foreground color | tput setaf [1-7] |
Set bold mode | tput bold |
Set half-bright mode | tput dim |
Set underline mode | tput smul |
Exit underline mode | tput rmul |
Reverse mode | tput rev |
Set standout mode | tput smso |
Exit standout mode | tput rmso |
Reset all attributes | tput sgr0 |
- Colors
- 0=black; 1=red; 2=green; 3=yellow; 4=blue; 5=purple; 6=cyan; 7=white
For an example, to make the terminal font colour green, execute
tput setaf 1
References
- Tansley DSW (2000). "Creating screen output". Linux and UNIX shell programming. Safari Tech Books Online. Addison-Wesley. ISBN 978-0-201-67472-9.