I often find myself scrolling back through the terminal with the mouse-wheel to see the first of many C++ template errors issued by a command. Anticipating this, I'll hold down the Return key to give some space from previous outputs; to allow me to more easily read off the first error. I find this preferable to piping into head -n as then I have to estimate n. Similarly, the clear command only clears the terminal screen.

Is there anything faster than holding down Return like this? I've seen solutions appropriate for scripting (echo loops; jot; yes/head), but was wondering if there's a short command I'm unaware of.

  • what about reset
    – Lambert
    Jun 17, 2015 at 11:46
  • 1
    Then how about: alias space='for lines in {1..10}; do echo; done'. Then call space from the terminal to get 10 blank lines.
    – Lambert
    Jun 17, 2015 at 12:00
  • 2
    No - just type CTRL+L together.
    – mikeserv
    Jun 17, 2015 at 12:25
  • 1
    Key-bindings in bash: bind '"\e[24~":"\n\n\n\n\n"' and press F12.
    – FloHimself
    Jun 17, 2015 at 12:34
  • 1
    @roaima - I didn't mean it would run the shell alias, necessarily. It doesn't get run as a command, exactly, but it interprets it as input. So you could have alias _l=$'\n\n\n\n\n' and then do <ESC>@l and it will enter 5 newlines for you. They can also be used recursively - and can even swap command/edit modes w/ <ESC>.
    – mikeserv
    Jun 17, 2015 at 13:45

10 Answers 10


There are a few options that spring to mind

  1. Spacer lines:

    sl() { yes '' | head -"${1:-5}"; }    # Use as "sl 10" or "sl"
  2. Pipe the output of your make through a pager:

    make {whatever} 2>&1 | less
  3. Run the entire session under screen. You can then Ctrl AEsc and scroll up through the buffer a page at a time using Ctrl B. Use ReturnReturn to exit scrollback mode


I wrote a little C program to print three lines of bricks across the terminal for this purpose. Not empty space, but it helps give visual separation in the same way, and stands out in verbose output that might have a bunch of vertical space. Swap out your favorite character to taste:

#include <termios.h>
#include <sys/ioctl.h>
#include <stdio.h>
int main(int argc, char *argv[])
    struct winsize ws;
    ioctl(0, TIOCGWINSZ, &ws);

    int i=0;
    // square:       \u25A0
    // large square: \u2B1B
    // block:        \u2588
    for(;i<3*ws.ws_col;++i) printf("\u2588");
    return 0;

I have

alias five='echo -e "\n\n\n\n"'

for that, you can further shorten the alias to your liking of course.

  • This is similar to the comment from @Lambert. I do like the use of the word "five" here though. I'd more likely use "twenty" or "thirty", but I do get your point. My response to @Lambert was that I hoped this may already exist. The number of lines could be an environment variable; with a default value. Shall we call it space?
    – user7543
    Jun 17, 2015 at 12:09
  • 1
    I didn't see Lamberts comment, as it is part of the show X more comments under your question. The name should be short, otherwise typing is to cumbersome, I chose 5 lines as I wanted to have the visual break when scrolling back in the terminal.
    – Anthon
    Jun 17, 2015 at 12:16
  • 1
    It would be nice to bind Ctrl+L to do that command within the terminal, but I never found out how. The other drawback I cannot use it in long running proceseses (or in tail -f) to generate some visual separation, like I can with pressing return a couple of times.
    – Anthon
    Jun 17, 2015 at 12:20
  • It seems to do it already for me. I'm using gnome terminal on Ubuntu. @mikeserv put this in the comments.
    – user7543
    Jun 17, 2015 at 12:28
  • @Anthon; you might have a look at unix.stackexchange.com/questions/36922/… where you should be able to use xdotool or xvkdb to print some text to an program and you should be able to set a global hotkey to run the tool. Did not get that to work properly so the CTRL+L is the best choice for this particular question.
    – Lambert
    Jun 17, 2015 at 12:31

I trust you already have enough ways to abbreviate echo -e "\n\n\n\n\n\n", so I won't add to that. But you have another option: Many terminal emulators support searching, so you can go to the start of the last command by searching backwards for some part of your prompt. (Or for some known string in the output, but the prompt is always there.)

TBH I usually just do the same thing you've been doing-- my Return key repeats fast enough that it never bothered me much to just hold it down.


You can use clear multiple times (clear;clear) or just hold down Ctrl+L until you satisfy!

With zsh, you can try (fun with repeat):-

  • repeat 5 clear
  • repeat 20 echo
  • repeat 50 printf '\n'

And of-course you may want to alias goaway='repeat 7 clear'.


Another approach could be to have some unique text in your prompt (I use $ followed by a non-breaking space (PS1=$'$\ua0')).

And configure your terminal emulator to scroll-back to it upon some key press.

For instance, with GNU screen, in ~/.screenrc:

defscrollback 5000
bindkey \033` eval copy "stuff k?$\240\r"

Would map that to Alt+Backtick


bash script to print a custom number of newlines:


if [[ "$1" =~ ^[0-9]+$ ]]
    for ((i=0; i<$1; i++))
    exit 0
exit 1

Name it (say script.bash) and put it in your $PATH (say in /usr/bin), run chmod +x /usr/bin/script.bash and call it with script.bash <number_of_lines>, or put it wherever you want, mark it as executable and add an alias to ~/.bashrc or ~/.bash_aliases:

alias script.bash='bash /path/to/script'

You can change / shorten the name and the alias to your needs. It can also be modified to print a default number of lines if no argument is passed:


if ! [[ "$1" =~ ^[0-9]+$ ]]
for ((i=0; i<$1; i++))

This is sort of a sideways answer to your question, but I prefer using an inverted prompt (which stands out and is easy to spot) for just the purpose of quickly being able to determine where in the scrollback the last command was run.

You can invert your prompt's color (i.e. black text on white background) by adding the ANSI sequences <esc>[7m (invert) to the beginning of the prompt, and <esc>[0m (reset) to the end of it.

Most, more fancy shells (like bash and zsh) also keep track of the length of the prompt on screen, so you'll need to add some sugar to tell the shell that these sequences do not move the cursor forward. In zsh this is done using %{...%} while bash uses \[...\].

Thus, to invert your prompt in zsh use:

PROMPT=$'%{\e[7m%}'"${PROMPT% }"$'%{\e[0m%} '

and in bash, use:

PS1=$'\[\e[7m%\]'"${PS1% }"$'\[\e[0m\] '

$'...' is a special way of quoting a string, which will translate \e into <esc>

${VARNAME%SUFFIX} removes outputs VARNAME, but strips off any ending string SUFFIX (in the above cases the final space, since we don't want to invert that in order to see the cursor properly).

Occasionally I find that the above trick is impractical (typically when the need arise to look at some logfile or something on a server which isn't really mine to customize to death), but on those occasions I usually find that all of the above suggested solutions are also too much of an effort, and I just press <enter> for a bit.


Just clear twice! Example:

clear; clear; echo "Hello World"

In bash I find CTRL+l moves the cursor to the top of the screen, but CTRL+L (i.e. CTRL+SHIFT+l) moves the cursor to the top of the screen, and inserts around a screen of space beforehand. Ideal! Thanks @Anthon.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .