0

I am using Screen with scrollback 100000. When I run the command clear or any other similar commands like Cmd-K (SSH to linux machine on MAC), it just clears the current displayed screen, not the scrollback history.

I googled and found out that if I press Ctrl-A then type "scrollback 0" and press Ctrl-A again and type "scrollback 100000", it clears the scrollback history, too.

However, I find this very cumbersome to write.

Therefore, I am trying to have an easier way to run these two commands for me.

First, I searched how to use bind command. First I wanted to bind a string to the commands but couldn't find a way to bind a string. (eg. bind the string "clear" to the commands above). Then, I tried binding ESC and c combo to run those commands for me. I couldn't figure this out.

Then, I tried using a bash script to run these commands. I want this bash script to be named "clear" so when I type "clear", it runs this script instead of running the command "clear". However, I couldn't find a way to make the script send Ctrl key to the terminal and run these commands (assuming terminal is where it accepts the Ctrl key).

Can someone please guide me to the right direction?

whiteSkar
  • 1,614
  • 2
  • 17
  • 30

1 Answers1

0

This question was asked (and answered) in How to clear the scrollback in the screen command?, referencing a gnu.screen.user mailing-list item Subject: Re: delete screen scrollback buffer - msg#00029

bind / eval "scrollback 0" "scrollback 100000"

You probably do not want to bind that to an easily typed key. See The Screen User's Manual for more detail.

The place to put screen's key-bindings is in your ~/.screenrc. You can see the effective bindings using ctrl+A?. Note that to use this binding, you must prefix it with the command character (usually ctrl+A.

Community
  • 1
  • 1
Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
  • That post is where I found out that setting scrollback to 0 and setting it back clears the scrollback history. However, that command doesn't seem to bind / key. Also, I thought "bind" command was bash command.. So I was looking at bash bind manual. Thanks for correcting that though. – whiteSkar Jun 28 '15 at 07:53