1

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?

2
  • I still can't figure it out. I mean, when you scroll down to the end of a man page, where the (END) prompt appears, is there a way to display the number of lines in the man?
    – Chen A.
    Commented Aug 8, 2011 at 10:57
  • 1
    Yes, I verified that behavior before I posted my answer. With the environment variables set as I've said, then pressing "G" to get to the bottom of the man page, you get the line count. Try $ MANPAGER=less LESS=-M man ls I just tried that here, and verified that it gives the line count. Commented Aug 8, 2011 at 12:10

1 Answer 1

5

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:

  1. Set your MANPAGER or PAGER environment variable to less.
  2. Add -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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .