Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I view a file in Linux with the 'less' command, I often only get a ":" prompt in the bottom left corner. There's no clue about how long the file will be, or at which location I am currently. When reading manpages with 'man', there's a file title and line number in that corner. And once I hit the end of the file, there's even a percentage shown. I've learned about 'less -m' but it's not that powerful. So what does 'man' differently from 'less'? They appear to be the same viewing programme, except for that file information difference.

(Using Ubuntu 10.4 LTS)

share|improve this question

migrated from stackoverflow.com Aug 1 '10 at 15:58

This question came from our site for professional and enthusiast programmers.

7 Answers 7

strace man

reveals that it just calls pager.

man pager

reveals that pager is actually less. And indeed

$ ls -al /usr/bin/pager
lrwxrwxrwx 1 root root 23 2009-08-18 17:30 /usr/bin/pager -> /etc/alternatives/pager
lrwxrwxrwx 1 root root 13 2009-08-18 17:19 /etc/alternatives/pager -> /usr/bin/less

so less has some presets which are invoked when called by the name pager.

Actually strace also reveals these environment variables:

"LESSCHARSET=utf-8",
"LESS=-ix8RmPm Manual page less(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e 
(END):?pB %pB\\%..$PM Manual page less(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e
(END):?pB %pB\\%..$",

So that's it!

share|improve this answer
    
Okay, I now found that there's a LESS environment variable and that you can specify "prompts" in less. But the manpage is so very complicated to read in that section that I probably do that later if at all. Or does anybody know a practical solution for that? Using the very environment variable from above doesn't change a thing for me. –  LonelyPixel Aug 9 '10 at 17:30

less -M will show current line information in the status area.

share|improve this answer

less is designed to work with a stream (a pipe) which length is normally not known. Man is always working on file, so it could always provide this information.

share|improve this answer
    
less can operate on files just fine. By default it shows the filename initially, and there are options that will make it show it constantly. –  Matthew Flaschen Jul 31 '10 at 22:05

Have you tried looking at man less or typing (I think) H in less to see the gazillion options? I'd look it up for you but I'm not on a Linux machine at the moment.

share|improve this answer

Ctrl-G will give you some file stats at the bottom of the page.

share|improve this answer

That information comes from the LESS environment variable, which man populates. You can find the value in the man page for man. I recommend considering the most pager instead. You can do this by installing most and changing the PAGER environment variable. It has useful features like colorization, and will show the filename at all time by default.

share|improve this answer

On Ubuntu I tried Colorful man suggested on commandlinefu and have been satisfied.

share|improve this answer

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.