Ubuntu – Terminal: Scroll past end of line so that last line appears in the middle of the screen

gnome-terminal

I recently switched to Ubuntu from Windows10. In the windows command prompt, you could scroll past the end of the line and make the last line appear in the top of the screen. I think it's really helpful in keeping concentration at the work you're currently doing as you don't have to see (and thus not having to worry) about what you wrote before.

Unfortunately, I can't get my Ubuntu 20.04 terminal do this. I searched this site and other sites for a couple of days and could not find any solution. Someone please help me out.

I want to scroll beyond the last line in the terminal so that what I'm currently writing stays on top or at least in the middle of the screen.

Thanks in advance!

Best Answer

Instead of scrolling, you can use the Ctrl+L shortcut to clear your terminal screen and have the prompt on the top of the terminal. Using this shortcut, you will be able to scroll back to the previous terminal output.

Alternatively, you can make use of the clear command and run:

clear -x

to clear your terminal screen the same way the Ctrl+L shortcut does. Note the use of the -x flag. If you don't use that, the terminal's scrollback buffer will also be cleared, so you won't be able to scroll back to the previous output.