-1

I noticed that the terminal cursor starts at the top of the terminal and slowly moves down as more commands are executed, until ultimately settling on the bottom regardless of the number of commands. After which time running clear jolts it back to the top. This behavior seems consistent with all terminals on my system.

Is there a history to this behavior? Are there any terminal emulators that behave differently?

I think there's and argument to be made for better ergonomics. For example, why not have the cursor settle at the top to reduce downward neck craning? Or why not make the input cursor static so a user does not need to follow the cursor movement throughout command executions?

7
  • 2
    For example, why not have the cursor settle at the top to reduce downward neck craning? - how would you see output of commands in this case? Commented May 20, 2021 at 17:49
  • Linking in unix.stackexchange.com/q/307177/117549 and unix.stackexchange.com/questions/88972/… Commented May 20, 2021 at 18:05
  • Since (European) languages are read left to right and top to bottom, it's rather natural for the latest output, and hence the prompt after a command to appear at the bottom. Starting at the top initially perhaps matches how we start writing on an empty page, but it shouldn't be too hard to change the shell's prompt setting to always print it at the bottom of the screen. Commented May 20, 2021 at 20:56
  • If you are trying to code a console there is an easy work around to this top-bottom terminal. Just print out 50 lines of "nothing" and bam, the next command you input will be at the bottom instead of the top. Commented May 20, 2021 at 22:12
  • 1
    Indeed, the early Lear-Siegler ADM-3 terminals had a fixed cursor position on the bottom line of the display. Output appeared there, and scrolled up in response to newlines being sent to the terminal. Clearing the screen erased the display, but the cursor remained at the leftmost column of the bottom line. Concepts such as "Home", "Erase-to-End-of-Line" (EOL) or "Erase-End-Of-Screen" (EOS) were not always widely supported back then. Which is largely why the termcap facility exists in UNIX today. Commented May 27, 2021 at 9:57

2 Answers 2

4

The history is that early I/O devices for computers were teletypewriters. These were typewriters which could be connected electrically, so keys pressed would not only put print on paper, but also send information to another device (not necessarily a computer), and that other device could instruct the typewriter to print characters on paper without involving keys.

This has a number of consequences, including:

  • input and output are combined on the same medium “of record”, in the order in which they are produced;
  • input devices can in some cases produce their own record (see stty echo);
  • most relevant to this question, since the systems we use now are mostly based on practices developed in the US and Western Europe, output starts at the top left of a sheet of paper or whatever representation thereof is used.

When screens were added (not necessarily in stead of paper), they were used as a viewport on infinitely-scrolling fan-fold paper. Old habits die hard, and this has survived to this day in terminal emulators (which are by definition throwbacks).

Other input models do exist, including on glass terminals — for example, IBM 3270 terminals are block-oriented and typically used with applications that manage screenfuls of information rather than scrolling information.

The shell isn’t the only way to interact with your computer, and some programs supplement that with alternative models. One example is “orthodox file managers” such as Midnight Commander (inspired by Norton Commander, on DOS PCs); these commonly have a command-line prompt in a fixed position at the bottom of the screen, and provide access to the output in a separate view:

The Midnight Commander command-line

Midnight Commander’s output view

2

Believe the way it is is the most natural way. At least for people reading left-to-right, top-to-bottom.

A terminal can be viewed as an eternal book / log. It could of course be arranged in reverse, but that would cause some issues. One is that one often work with streams. One would also need to constantly re-arrange the buffer / view.

One problem with multi-line output would be that the end of output could be below the view, thus after a command one would have to scroll down to see. One could of course argue the opposite - that now one have to scroll to see the top, but believe one on average are more interested in last output.

Focus is at bottom because that is where last action is / was.

With command line at top, one would also constantly need to shift focus from top to bottom. Say you do tail -n 10 some_file. You would read the 10 lines, then shift focus back to top.

A command printing information in intervals. How should one do this? Print - read that section. Move focus up, read down to where previous print started, move focus up, repeat.

Believe that would be more prone for missing things then reading top-to-bottom.

Or say one do a command that results in 10k lines. Should one scroll down to view end result? Or say you compile a program. How should the output be arranged?

One have programs that utilize static "comand line", for example terminal IRC clients (irssi, weechat, ...). Here one (typically) have command line at bottom, and log top-to-bottom above that.

In effect a terminal is the same when it screen is filled, though one are not limited by the height of a input line.

The way it is is

  1. the simplest way by far (implementation wise),
  2. for most (I believe) the most natural way to read information.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.