Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'the LESS environment variable' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
the LESS environment variable
Authored by: mervTormel on May 14, '02 02:33:04AM

rather than creating an alias and masking the command's default behavior,
this option would be better implemented by setting the LESS environment
variable. see the man pages.

% setenv LESS "-c -i -M -s"



[ Reply to This | # ]
the LESS environment variable
Authored by: wngdn on May 14, '02 10:04:23AM

A better way to set the options for less is to set the LESS environment variable. Set it to "-options", including all the options you want. My favorite is "-Mi", but I guess now on OS X I'll do "-Mic". ("man less" to find out what -M and -i do.)

So,

setenv LESS "-Mic"

Cheers,

Wangden



[ Reply to This | # ]
the LESS environment variable
Authored by: vonleigh on May 14, '02 12:32:44PM

Hello,

How do you set less to be the default instead of more for man pages and such?

Also, why do people like less more than more? I read the man page for less and it says "but which allows backward movement in the file as well as forward movement." But I tried using b (for back) and it also works in more. Is it because it's faster?

I'm using setenv LESS "-Mice" (i like it to quit at the end of the file)


Vonleigh



[ Reply to This | # ]
the LESS environment variable
Authored by: osxpez on May 14, '02 03:54:23PM

To use less as your default pager you set the PAGER environment variable to "less". In bash:

export PAGER='less'

less is like more on steroids. If you're familiar with the "vi" editor you will find less familiar. You use / for searching forwards, ? for backwards and less will highlight the matches for you. '<letter> will but a mark <letter> in the document and m<letter> will jump to that mark. <number>G will jump to line <number>. G alone will jump to the last line in the file. And if the file is growing while you are paging it hitting G again will jump to the now last line (a bit like an interactive "tail -f"). And there's lots and lots more like this.

I see no reason at all for you to keep hanging on to "more". =)



[ Reply to This | # ]
the LESS environment variable
Authored by: gvitale on May 16, '02 05:24:01AM

what about the tcsh (please)?



[ Reply to This | # ]
the LESS environment variable
Authored by: gvitale on May 16, '02 05:28:37AM

nevermind, I solved this one on my own:

setenv PAGER less



[ Reply to This | # ]
less vs more
Authored by: a1291762 on May 14, '02 07:45:02PM

I think that most 'more' commands are actually less running in compatibility mode.

Unless you're on a commercial Unix (HP-UX, SunOS, AIX) then you probably have the same binary for more and less.

The "real" more doesn't allow backing up or searching etc.



[ Reply to This | # ]