If you wanted to "clear above", that is not as straightforward as typing "clear". The escape \033[1J erases from the upper-left to the current cursor position. You could make a script which does this, to clear only the lines above your current cursor:
- use the cursor position report to find the row/column on which the cursor currently is, and
- if the cursor is not on the first line, (saving that position), move the cursor up one line and then (with the
hpa sequence) move right a large number, - issue the "clear above", and
- return to the original position using
cup (cursor addressing).
That part with the cursor position report doesn't seem as if it would work in (for example) a readline binding, so I suggested a script.