Clear the terminal (but keep the last few lines)

Suppose I've been in the terminal for a while, and it's length is very concerning (or equivalently a program that spits out a very long output).

Is there a way to keep the last 10 lines (for example), and clear the rest?

(Without scroll-back capability)


Solution 1:

tput cup Y X

Move cursor to screen location X,Y (top left is 0,0)

tput ed

clear to end of screen

So:

$ tput cup 10 0 && tput ed

source