linux终端复位什么意思,我可以使用哪些命令来重置和清除终端?

要在运行PuTTY时清除控制台屏幕和回滚缓冲区,这对我有用:

echo -en "\ec\e[3J"

实际上,这是2个独立起作用的“ Esc”序列...可以按以下顺序使用它们:

# clears the console screen, but not the scrollback buffer

# this is actually the escape code to "reset" the terminal

echo -en "\ec"

# clears the scrollback buffer, but not the console screen

# screen content remains, and cursor position remains at its last position

echo -en "\e[3J"

使用echo -en "\ec"哪个复位终端可以更改其他一些终端设置。代替“重置”,您可以这样做:

# position the cursor to "Home" (Top Row, First Column)

echo -en "\e[H"

# Erase down: clear the screen from the cursor down to the bottom of the screen.

echo -en "\e[J"

# Note: this is supposed to clear the screen and position the cursor to home,

# but it didn't work like that for me. It cleared the entire screen (above and

# below the cursor), but left the cursor at its last position.

echo -en "\e[2J"

# putting everything together

echo -en "\e[H\e[J\e[3J"

您可以将其放在shell脚本中,并且效果很好。

如果存在一些系统依赖性:

我正在将PuTTY连接管理器(版本0.7.1 BETA(内部版本136))与PuTTY(版本0.60)一起使用。

输入:

echo \"$TERM\"; /bin/sh --version

报告:

"xterm"

GNU bash, version 4.1.2(1)-release-(x86_64-redhat-linux-gnu) ...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值