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

  • Thread starter Thread starter member 428835
  • Start date Start date
  • Tags Tags
    Linux Output
Click For Summary

Discussion Overview

The discussion revolves around the behavior of terminal output in Ubuntu 18.04, specifically the desire to have new text appear at the top of the terminal rather than the default bottom-to-top arrangement. Participants explore various methods and implications of altering this output behavior.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • Some participants suggest using the clear screen ANSI code in the prompt to start new commands at the top, but note that this requires manual scrolling to view previous output.
  • There is a proposal to pipe command output to tools like less to manage screen overflow, though this does not directly address the original request.
  • One participant expresses confusion over the desired output behavior, questioning how new lines would be displayed when the screen is full.
  • Another participant mentions that they have never encountered a terminal that operates in the proposed manner, suggesting it could be adapted from existing code.
  • Concerns are raised about the practicality of having new output appear at the top, with some participants doubting its usefulness.
  • A script is provided as a potential workaround, which clears the screen and runs commands, but does not fundamentally change the output order.

Areas of Agreement / Disagreement

Participants express varying levels of understanding and agreement regarding the feasibility and practicality of changing terminal output behavior. No consensus is reached on a solution, and multiple competing views remain regarding the usefulness of the proposed changes.

Contextual Notes

Participants note limitations in existing terminal behavior and the potential need for custom solutions, but do not resolve the underlying technical challenges or assumptions about user preferences.

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
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:
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.
 
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.
 
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?
 
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.
 
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   Reactions: jtbell, jim mcnamara, phyzguy and 2 others
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   Reactions: nsaspook and pbuk
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   Reactions: member 428835

Similar threads

Replies
4
Views
3K
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 18 ·
Replies
18
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
16
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K