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?