Why do ‘man’ pages have many extra lines

command linelessmanpager

When I run the command:

man fork

There is a highlight line at the bottom that reads:

Manual page fork(2) line 52/99 (END)

But when I navigate to line 53 and up to 99, these are just blank lines. Why does Linux system have these extra lines? What are their main purpose?

Best Answer

The document you're viewing (the man page) has 99 lines. If you scroll to the bottom of the document, the 99th line will be at the bottom of the terminal. The pager (less) reports the line number at the top of the terminal: when you're at the top of the document, you'll see line 1/99; at the bottom, you see line 52/99 because you have a 49-line terminal (showing the last 48 lines, i.e. 52 to 99, plus the less status line).

Less doesn't normally scroll beyond the last line of the document. But if you explicitly tell it to (e.g. with 53g to put the 53rd line at the top of the screen), it adds empty lines (actually, lines with a ~, unless you run less -~).

Related Question