我一直在使用命令:
reset
Run Code Online (Sandbox Code Playgroud)
清除我的终端。虽然我很确定这不是我应该做的。重置,顾名思义,重置你的整个终端(改变很多东西)。这是我想要的:
我基本上想使用命令clear。但是,如果您清除然后向上滚动,您仍然会收到大量以前的内容。一般来说,这不是问题,但我正在查看很长的总日志,我想确保我只是查看最新的日志。我知道我可以使用more或类似的东西,但我更喜欢这种方法。
我正在使用 bash 4.3.11(1) 并安装了以下历史插件(通过.bash_it):
# enter a few characters and press UpArrow/DownArrow
# to search backwards/forwards through the history
bind '"^[[A":history-search-backward'
bind '"^[[B":history-search-forward'
Run Code Online (Sandbox Code Playgroud)
当我登录到交互式会话时一切正常,但是当我通过ssh host 'ls -als'例如运行远程命令时,我看到以下输出:
: ssh host 'ls -als'
/home/ubuntu/.bash_it/plugins/enabled/history.plugin.bash: line 3: bind: warning: line editing not enabled
/home/ubuntu/.bash_it/plugins/enabled/history.plugin.bash: line 4: bind: warning: line editing not enabled
Run Code Online (Sandbox Code Playgroud)
当我echo -e '\0033\0143'在每次绑定调用后修改历史插件时,我不再收到警告,但我的控制台已被清除。不是一个巨大的缺点,但知道一种更简洁的方法来抑制远程命令的这种情况会很好。
# Works, but annoyingly clears console
# enter a few characters and press UpArrow/DownArrow
# to search backwards/forwards through the history …Run Code Online (Sandbox Code Playgroud)