Clearing Terminall screen will not clear scrollback

Hi,

In Terminal, “clear” just pushes what is in the screen up, and clear the visible portion of it, but will not clear the scrollback lines.

When running something with long outputs, it is useful to be able to have in that buffer just the parts of interest, and not parts of previous commands.

In both Haiku and Debian ( Devuan actually, because it is that that is installed in this machine ) , the clear command issues the same codes ( [H[2J[3J ) , that should be enough to clear a xterm screen, but in Haiku the [3J one and its relatives ( tput clear, tput reset, and a bunch of other codes I copied from linux threads and tried ) didn´t work.

Is there some specific configuration that needs to be done for that to work, or is this some not-yet-implemented specific of Haiku´s Terminal application ?

Thanks,

2 Likes

You can use the “reset” command, or alternatively you can press alt+L to clear the scren. I don’t know which escape sequence is used by the reset command in our case but it must be possible.

1 Like

reset command don’t clear scrollback:

screenshot288

As showed, reset command doesn´t clear the screen / scrollback.

Alt-L works, but doesn´t return to the prompt, leaving just the cursor blinking at the top. An Enter press is needed.

While a ‘clear’ utility working as expected would be nicer, how to send the ‘Alt-L’ combination from a program/script that is running in that terminal, so that the Alt-L + Enter combination could be sent and work as a ‘homegrown’ clear of sorts ?

Thamks

1 Like