Linux terminal output top-to-bottom instead of default bottom-to-top?

In summary, the conversation was about ways to have the terminal output new text at the top of the screen instead of at the bottom, causing discomfort for the user. Various options were discussed, such as using the clear screen ANSI code in the prompt, using the pgup key to see previous output, or piping the output to "less." However, the main issue was that these options all delete previous output. The user then mentioned a desired feature where new text would go down instead of up, and provided an example of how it would work. The experts in the conversation expressed confusion and skepticism about the usefulness of this feature. Finally, a script called "run" was suggested as a potential solution for this issue.
  • #1
member 428835
Hi PF!

I am running Ubuntu 18.04. The terminal output has all new lines at the bottom of the screen. This is giving me some discomfort. As such, is there a way to have the terminal output new text at the top? I've googled it but didn't find much.

Thanks!
 
Computer science news on Phys.org
  • #2
Clearing the screen will start lines at the top. You could put clear screen ANSI code in your prompt and that will start new commands at the top.

However, to see any command output you will have to do a pgup key press.

What are you hoping to have a terminal that when the last line is reached pauses like vi or less requiring you to pgdn to see the next page?

or something that clears the screen and starts at the top again when you execute a new command?

Here's discussion on prompt screen clear options.

I could see a scheme where you start at line one:

Bash:
$ ls -alh <return-key>
xxxx
xxxx
xxxx
xxxx
$

when you type the next command the return-key causes the screen to clear and repaint the command line and then run the command:

Bash:
$ du -ah <return-key>
xxxx
xxxx
xxxx
xxxx
$

Here's another scheme where the prompt puts you at the top again.

https://unix.stackexchange.com/questions/218323/keep-bash-input-on-top-line-of-screen

It has some caveats though.
 
Last edited:
  • #3
jedishrfu said:
Clearing the screen will start lines at the top. You could put clear screen ANSI code in your prompt and that will start new commands at the top.

However, to see any command output you will have to do a pgup key press.

What are you hoping to have a terminal that when the last line is reached pauses like vi or less requiring you to pgdn to see the next page?

or something that clears the screen and starts at the top again when you execute a new command?

Here's discussion on prompt screen clear options.

I could see a scheme where you start at line one:

Bash:
$ ls -alh <return-key>
xxxx
xxxx
xxxx
xxxx
$

when you type the next command the return-key causes the screen to clear and repaint the command line and then run the command:

Bash:
$ du -ah <return-key>
xxxx
xxxx
xxxx
xxxx
$

Here's another scheme where the prompt puts you at the top again.

https://unix.stackexchange.com/questions/218323/keep-bash-input-on-top-line-of-screen

It has some caveats though.
Yea I saw these as well, but the issue is that they delete previous output. I'd like new text output to go down as opposed to up, where my cursor starts at the top.

Thought it was trivial but starting to think not.
 
  • #4
joshmccraney said:
I'd like new text output to go down as opposed to up, where my cursor starts at the top.

But what happens when your screen is full? The way you describe it, the last line printed will be the firts one to scroll away.

Probably the most useful thing to do is to pipe the output to less, e.g. ls -alh | less.
 
  • #5
Vanadium 50 said:
But what happens when your screen is full? The way you describe it, the last line printed will be the firts one to scroll away.

Probably the most useful thing to do is to pipe the output to less, e.g. ls -alh | less.
Sorry if I've been unclear. Every time the terminal creates a new line, that line appears immediately below the previous line. i.e.

>> hi----------end page

>> how are you
>> hi

----------end page

>> I'm good
>> how are you
>> hi
----------end page

>> I'm good too
>> I'm good
>>how are you
----------end page

where I would then have to scroll down (not up) to see >> hi

Perhaps I've confused more than clarified?
 
  • #6
joshmccraney said:
where I would then have to scroll down (not up) to see >> hi

Perhaps I've confused more than clarified?
Well, you're confusing me. Now I have no idea what you mean.
 
  • #7
Do you mean this (note the prompt is set to $ and the _ represents the cursor).

User types "echo hi"
Code:
$ echo hi_
User hits return
Code:
$ _
hi
$ echo hi
User types "echo how are you?"
Code:
$ echo how are you?_
hi
$ echo hi
User hits return
Code:
$ _
how are you?
$ echo how are you?_
hi
$ echo hi
Eventually, the line "$ echo hi" scrolls off the bottom of the screen, followed by "hi" etc.

I have never heard of any terminal program that does this. It would be easy enough to adapt existing code to do it though, you might even find a feature request to a project like Tilda would get a response.

I've got to say though that I think there would be a lot of problems using this in practice: do you really want to see the following?
Code:
$ _
furnished to do so, subject to the following conditions:
copies of the Software, and to permit persons to whom the Software is
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
in the Software without restriction, including without limitation the rights
of this software and associated documentation files (the "Software"), to deal
Permission is hereby granted, free of charge, to any person obtaining a copy
$ cat LICENSE
 
  • Like
Likes jtbell, jim mcnamara, phyzguy and 2 others
  • #8
Oscar Wilde purportedly said:
There are only two tragedies in life: one is not getting what one wants, and the other is getting it.
- the second is worse

@pbuk pointed this out nicely.

Or - more pointedly, if this were at all useful somebody would have done it already.
Why is it not easy to find --Answer: See the first sentence above this one.
 
  • Love
  • Like
Likes nsaspook and pbuk
  • #9
Thanks for all the replies. Yea I'll give this up.
 
  • #10
Here's a "run" script that may help:

Bash:
#!/bin/bash
clear
echo`pwd` \$ $*
$*

to use it place in your bin directory or somewhere along your path and give it execute permissions via "chmod 755 run"

to run a command type:

Bash:
run ls -alh *.py
 
or

run df -h

Of course you could add an echo command to say "Working..." to give it some Star Trek retro flair.
 
  • Like
Likes member 428835

1. Why does Linux terminal output top-to-bottom instead of bottom-to-top?

The default behavior of the Linux terminal is to output text from the top of the screen to the bottom. This is because the terminal was originally designed for printers, which read text from top to bottom.

2. How can I change the default behavior of the Linux terminal to output bottom-to-top?

You can change the default behavior of the Linux terminal by using the command "tput rev" which will reverse the output order. This command can be added to your bash profile to make it the default behavior.

3. Are there any advantages to having the Linux terminal output top-to-bottom?

Some argue that having the Linux terminal output top-to-bottom can make it easier to read and follow the output of a command, especially for longer outputs. It also allows for easier scrolling through the output by using the arrow keys.

4. Can I customize the output order of the Linux terminal?

Yes, you can customize the output order of the Linux terminal by using the "tput rev" command as mentioned before, or by using the "tput cup" command to specify the starting position of the output.

5. Does the output order in the Linux terminal affect the performance or functionality?

No, the output order in the Linux terminal does not affect the performance or functionality of the terminal. It is simply a matter of personal preference and can be easily customized to suit your needs.

Similar threads

Replies
4
Views
2K
Replies
2
Views
1K
  • Computing and Technology
Replies
4
Views
1K
  • Computing and Technology
Replies
5
Views
1K
  • Computing and Technology
Replies
3
Views
1K
  • Computing and Technology
Replies
18
Views
1K
  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
2
Views
857
Replies
16
Views
2K
  • Computing and Technology
Replies
1
Views
991
Back
Top