Ubuntu – man pages – How to always show total lines and percentage in the bottom status / prompt line

bashcommand linelessmanpage

I want to always see the total lines and % part ( line 1/773 0% ) in the bottom status / prompt for man pages immediately upon viewing one.

When I open any man page I see this in the bottom line:

 Manual page man(1) line 1 (press h for help or q to quit)

But after pressing End then Home it changes to this:

 Manual page man(1) line 1/773 0% (press h for help or q to quit)

How can I always see the total lines and % when initially opening a man page, without pressing buttons?


I'm using less as man's pager, and it's beginning to look like less "just won't do that." I'd rather not install any extra programs (default Ubuntu/Xubuntu) or change man's pager, but if another pager that's similar to less works that'd be ok (most has nice colours, but it would need it's default Prompt changed).

I thought it'd be a simple setting, but maybe not.
I've tried a web search and searching this site, but didn't find anything relevant, maybe the % isn't very search-friendly or my keywords are off? Nothing in man man seemed relevant either, and the only %'s were unrelated.

Best Answer

Presumably, you are using less as the pager. You can not do what you want directly without recompiling less (at least i am not finding any such option) -- to read all the lines at first, get the end line number, and jump to the top with that info. But i think that would be clumsy and inefficient given the only prize is the total line number although YMMV.

Now, i am going to show you a hacky way, leveraging the LESS environment variable that less reads to get automatic option(s):

 LESS='+Gg' man <whatever>

For example:

LESS='+Gg' man bash

Inside less, G will go to end (without any line number), and g will jump to the top (without any line number). As there will done by less at first, it will have the idea of the total line numbers while coming back on top, and will show you that. Again this has the caveat of reading till the end once, and then coming back on top.