Is it possible to scroll beyond the end of a file in the less pager?

Yes, using J (as in ShiftJ). So you can go to the end of the file with G, then scroll down past the end with J until the last line of the file is at the top of the screen (less won’t let you scroll any further).

K and Y do the same at the top of the file, scrolling up past the beginning until the first line is at the bottom of the screen.

As David Ongaro points out, you can use repeat specifiers to avoid having to press J multiple times: G99J will thus scoll down until the last line is at the top of the screen (unless your terminal has a very large number of rows).


The -c option also creates "scroll past EOF" behavior in some circumstances.

Without -c, when you are near the end of file (the remaining part after the part you currently see is less than a screen height), the space scrolls down just enough to put the last line of the file on the last line of the screen. space can be equivalent to j if there's only one more line to show.

With -c, as long as you aren't at EOF already, space always scrolls forward a full screen height. The top line on the screen after space will be the line after the one that was at the bottom before the space. This can leave some portion of the screen unused, and it is filled with the ~ markers.

In -c mode, to make the last line the only visible line, G K space is all you need.

...unless the last line in the file is wider than the screen width, in which case you need to repeat the K.