获取终端能显示的行数和列数:
[student@myhost ~]$ tput cols
140
[student@myhost ~]$ tput lines
35
获取终端名:
[student@myhost ~]$ tput longname
xterm with 256 colors[student@myhost ~]$
将光标移动到指定位置:
[student@myhost ~]$ tput cup 100 150
文本设置为粗体:
[student@myhost ~]$ tput bold
设置下划线的起止:
[student@myhost ~]$ tput smul #下划线开始
[student@myhost ~]$ tput rmul #下划线停止
删除光标位置之后所有内容:
[student@myhost ~]$ tput ed
输入(stdin)不显示在屏幕上(类似于su输入密码时):
[student@myhost ~]$ stty -echo
之后可以通过stty echo显示输入。示例如下:
[student@myhost ~]$ cat a
echo Plsase input password:
stty -echo
read password
stty echo
echo Your password is $password.
[student@myhost ~]$ bash a
Plsase input password:
Your password is hhh.
保存光标位置与恢复光标位置:
$tput sc #保存光标位置
$tput rc #恢复光标位置