Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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? – Vinny Aug 8 '11 at 10:57
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. – Warren Young Aug 8 '11 at 12:10
up vote 5 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.