How to clear the scrollback in the screen command?

僤鯓⒐⒋嵵緔 提交于 2019-12-03 06:42:04

问题


I use the screen command for command-line multitasking in Linux and I set my scrollback buffer length to a very large value. Is there a key combination to clear the buffer for a certain tab when I don't want it sitting there anymore?


回答1:


This thread has the following suggestion:

In the window whose scrollback you want to delete, set the scrollback to zero, then return it to its normal value (in your case, 15000).

If you want, you can bind this to a key:

bind / eval "scrollback 0" "scrollback 15000"

You can issue the scrollback 0 command from the session as well, after typing C-a :. HTH.




回答2:


  • C-a C will clear the screen, including the prompt
  • clear (command, not key combination) will clear the screen, leaving a prompt

ETA: misread the original question; these will just clear the visible text, but will not clear the buffer!




回答3:


I added the command "clear" as well to clean the current screen. N.B. You have to press enter to regain you prompt.

bind '/' eval "clear" "scrollback 0" "scrollback 15000"

Also add it to you ".screenrc" to make it permanent.

N.B. I added single quotes around the slash to be sure it didn't interfere in my ".screenrc". May not be necessary.




回答4:


alias cls='printf "\e[3J\033c"'

Clears the screen and scrollback buffer.




回答5:


^a : clear

worked for me on Ubuntu.




回答6:


Command-K seems to be best solution for Mac. For more details and explanations, please refer to this page.




回答7:


From the man page:

C-a C       (clear)       Clear the screen.


来源:https://stackoverflow.com/questions/113427/how-to-clear-the-scrollback-in-the-screen-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!