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 #恢复光标位置
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南