Fah*_*tha 15
这
reset
Run Code Online (Sandbox Code Playgroud)
命令是ncurses 的一部分,位于Debian 上的ncurses-bin包中,它将完全清除控制台。那是你要的吗?
reset来自手册页的简要摘要:
reset 设置煮熟和回声模式,关闭 cbreak 和原始模式,打开换行转换并将任何未设置的特殊字符重置为其默认值,然后以与 tset 相同的方式进行终端初始化。
正如在https://superuser.com/questions/122911/bash-reset-and-clear-commands 中讨论的那样,正如 Erik 在Shell console clearing 中指出的那样,clear只会清除屏幕,reset将(正如 bignose 所说), “当它被控制序列搞砸时重置你的终端”。就我个人而言,我很擅长弄乱我的终端,当我清除它时,我不想找回之前存在的任何东西,所以我只使用reset. 但是嗯。
小智 9
我通常只使用:
clear
Run Code Online (Sandbox Code Playgroud)
从clear手册页:
clear clears your screen if this is possible. It looks in the environ-
ment for the terminal type and then in the terminfo database to figure
out how to clear the screen.
clear ignores any command-line parameters that may be present.
Run Code Online (Sandbox Code Playgroud)
这不是您问题的答案,但您可以使用更少,并保持您的颜色,请参阅:https : //serverfault.com/questions/26509/colors-in-bash-after-piping-through-less
暗示:
$ grep --color=always foo bar.txt | 少 -r