2

I was wondering about the functionality of the clear (https://invisible-island.net/ncurses/man/clear.1.html) command, that I can evoke with CtrlL in my Terminal.app on macOS.

When executed, it should move my cursor to the top of the screen - what it does. That's great. But it has a side effect as well: It creates a whole lot of white space (depending on the screen size) on top of the command. For example look at this command line history:

➜ ~ some command command output ➜ ~ clear ➜ ~ # the input line is now on top; but there is a lot of whitespace in the history as well 

This is kind of bloating my command line history, when I scroll back. So I'm wondering, why is this white-space on top created?

8
  • 6
    What terminal emulator are you using? This has nothing to do with the command history, it is just the terminal's buffer fro scrollback, but I can't reproduce it. What terminal are you using that lets you scroll back past the clear command? Or are you using something like screen or tmux? Commented Sep 26, 2020 at 9:39
  • Presumably running the clear command doesn't have this side-effect Commented Sep 26, 2020 at 9:44
  • What's Terminal.app? There's no such application in Linux. Is it MacOS X? Commented Sep 26, 2020 at 9:48
  • On my Mac, it looks like it scrolls the current visible area out into the scrollback, so that it's not lost when the screen is cleared. You'll see that if you fill the screen with anything before running clear, you only get one empty line then. Of course it could detect that part of the screen was already empty and not store that, but that's more work. Not an answer since I don't know if this is the actual why. Commented Sep 26, 2020 at 11:36
  • 3
    Ah look! It is unix.stackexchange.com/q/375743/5132 again, except with Terminal.app instead of GNOME Terminal. Commented Sep 26, 2020 at 12:41

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.