Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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? –  kovadom Aug 8 '11 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. –  Warren Young Aug 8 '11 at 12:10
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.