I know that we can clear the entire buffer by using one of the following, as referenced here:
⌘ + K
printf '\33c\e[3J'
However, is it possible to clear the entire buffer except the last n
lines?
I know that we can clear the entire buffer by using one of the following, as referenced here:
⌘ + K
printf '\33c\e[3J'
However, is it possible to clear the entire buffer except the last n
lines?
You can clear the text on the current screen (up to the cursor position) using a different parameter (documented in XTerm Control Sequences):
printf '\033[1J'
Unlike \033[3J
, this is a standard sequence which you may find in ECMA-48. Apple provides no relevant documentation.