I know when you are in a man page it will display the file name at the bottom inside the man.
How can I do the same thing manually?
I'm not sure it is possible to do everything you ask, because man(1)
sends the formatted man page data to your pager program via a pipe. This would prevent showing a file name, for one thing.
You can get a line count at least like so:
MANPAGER
or PAGER
environment variable to less
.-M
to your LESS
environment variable, to get the "long prompt", which includes the line count.Instead of -M
, you can build your own less
prompt with the -P
option to get even more details. Again, though, there are some things in what you ask that less
simply won't have access to when acting as man
's pager program.
$ MANPAGER=less LESS=-M man ls
I just tried that here, and verified that it gives the line count.