Linux终端信息

获取终端能显示的行数和列数:

[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    #恢复光标位置
posted @   epiphanyy  阅读(9)  评论(0编辑  收藏  举报  
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
点击右上角即可分享
微信分享提示