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
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
9 replies · 6K views
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!
 
Physics 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
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