How to quickly add some space in the terminal

consoleterminalwhitespace

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.

Best Answer

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

Related Question