1

Why am I asking this?

As you can guess, it's mostly for curiosity. But why did the curiosity spring up in my mind?

Well, there's been a moment when I noticed that I was not happy that after I'd run clear to clean the terminal screen, I had then to move my eyes from the bottom of the screen, where the prompt ended up after sereral commands and their outputs, to the top of the screen.

That's when I inserted this in my ~/.bashrc:

__prompt_to_bottom_line() {
  tput cup $LINES
}
alias clear='clear && __prompt_to_bottom_line'

For me, having the prompt at the bottom after running clear means that the prompt is always at the bottom, never at the top. Everything else is like normal.

What about others?

I think I'm not the only one feeling this necessity. Take this question, for instance: the user wanted the prompt to be always at the top, and the output below it, but in reverse order (but one output from one command, even if multi-line, is not reversed, clearly).

If you think about it, what that user expects to see on screen is exactly the tac of what I expect (except that, again, multi-line outputs are not reversed).

So my question is

why was the terminal designed with this non-uniform behavior? By non-uniform I mean that it starts in a situation that's never gonna be repeated unless one clears, and that's gonna change command after command, with the prompt travelling down-screen, eventually with the prompt ending up in a "stable" position at the bottom of the screen, from where it won't move anymore, unless one clears.

Wouldn't the line always at the top/bottom with outputs pushed downward/upward be a more eye-friendly design?

4
  • I like your workaround (I always be lazy), but I think your question may requires "opinion based answers" (which are not allowed). I see also the contrary use cases: clear (and if you are using a lot of program using terminal screen features properly (top, vi, emacs, ``mutt), but also less` you may be customized to have important things on top. Apr 1, 2022 at 8:12
  • @GiacomoCatenazzi I've included the history tag, so I'm asking why are things like that, from an historical perspective. Is this opinion based?
    – Enlico
    Apr 1, 2022 at 8:16
  • I'me referring to the terminal emulator, as well as to the virtual console. Since in both of them I use bash, but I could use another shell, I think that yes, I'm asking about the shell's behavior.
    – Enlico
    Apr 1, 2022 at 8:35

1 Answer 1

2

I'me referring to the terminal emulator, as well as to the virtual console. Since in both of them I use bash, but I could use another shell, I think that yes, I'm asking about the shell's behavior.

The history of terminal emulators’ behaviour is supposed to be covered in Why does the input cursor always go from the top to the bottom in a terminal emulator? The answers there, including mine, are missing a historical overview of the Lear Siegler ADM terminals, since much of the behaviour is tied to their evolution. Early terminals only supported “bottom line entry” — the cursor was pinned to the bottom line; “downline scrolling”, which is the behaviour we’re familiar with today, was an option introduced with the ADM-3A.

The history of this aspect of shells’ behaviour(s) is that there isn’t really one: sh-style shells aren’t aware of the terminal or its capabilities. At its core, your shell only cares whether its input is coming from and its output is going to a device which pretends to be a terminal (as determined by the isatty function); it doesn’t know whether it’s a teleprinter, a glass terminal, a terminal emulator, or some other terminal-compatible device, virtual or otherwise.¹


¹ “At its core” because some features of current sh-style shells, e.g. select in Bash, are aware that the terminal has a given number of columns and lines.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .