0

In my case clear actually deletes all onscreen output. What I want is a way to start off with a clear terminal while still having access to all prior output by scrolling up.

I use Kitty and Fish btw.

1 Answers1

0

You can use clear -x to preserve the scrollback buffer, or CTRL+L keypress.

You could e.g. alias something like cls to 'clear -x' so you have two commands available, to either clear the buffer or not.

Both these work in Kitty 0.76.1.13, when I use it to SSH into Bash (or Fish 3.0.2) on a Debian remote computer.

  • In my case clear -x does not delete the scrollback buffer but it does delete the output that is currently on screen, meaning that content is no longer available in the scrollback afterwards. – J-Kappes Mar 20 '24 at 10:05
  • How odd. If I do clear -x I produce a clear screen, the cursor goes to the top of the terminal, and if I scroll up the first line that comes into view (the last line of the scroll buffer contents) is... the clear -x that I entered. Thus nothing that was on the screen before is lost. This is the same in bash and fish. Still using kitty. One difference with CTR+L (instead of clear -x) is that an extra blank line appears at the end of the buffer on scrolling up. – Michael Harvey Mar 20 '24 at 12:10