Sven Guckes guckes-less@math.fu-berlin.de ©1995-2003 | Latest change: Sat Feb 22 06:30:00 CET 2003 |
LESS runs on Unix systems (eg. AIX, FreeBSD, HP/UX, Irix, Linux, Solaris, SunOS, Xenix) and has also been ported to other systems: MS-DOS, OS/2, OS-9, and Windows (Windows95/98/NT/2000).
You can get the sources and precompiled binaries from the "LESS Download page" (see below).
The manual says:
LESS(1) USER COMMANDS LESS(1) NAME less - opposite of more
Well, what did you expect? ;-)
LESS is full of features and some of them are invaluable. The most important feature that makes LESS more usable than the standard pager MORE is that LESS allows backward movement within the file, too.
Using LESS at first seems to be unintuitive - like all powerful programs. Some of the key bindings are taken from Vi, so it gives you some consistency between these programs, eg a "number prefix" to commands.
Starting less on the command line gives you this:
$ less Missing filename ("less -\?" for help)
So you need to give something for LESS to look at - either input from stdin or a file. But you should try "less -\?" - what will happen is that LESS itself will show you the helpfile, so you can use the commands you read about right away. This self-reference may be confusing at first, but it's like like reading about email in an email or reading a FAQ about Usenet with a newsreader.
There are several ways to get help on LESS:
In every case LESS should display this at the bottom line:
HELP -- Press RETURN for more, or q when done
After using 'q' you will get another prompt from LESS:
End of help (press RETURN)
After pressing the return key LESS returns you to where you came from - either to the file you were looking at (usual case) or to the program that you called LESS from, most probably the shell.
You need not give your favourite options for LESS every time - just put these options into the shell environment variable LESS.
Example:csh/tcsh: setenv LESS aCMsei zsh: export LESS=aCMsei
These are my favourite options. Let me explain these options:
option | short description |
e | quit on second display of text end |
LESS will automatically quit when it has to display the end of a text for the second time. I use this setup when reading mails with LESS. When I had used "elm" as a mailer I had chosen "less" as the external pager to show the messages (which by the way get extracted from the folder by elm's utility "readmsg"). Without the 'e' option I would have to explicitly type 'q' to quit the pager. However, with the 'e' option it looks like this: I usually hit the space bar to advance page by page. Now, when "less" shows me the last line of the text then another space will normally not go further, but this makes LESS quit, so I get back to the index where I can chose the next mail to read. |
|
. and a | show all matches on current page + continue search on next page |
LESS will show all matches of the search string on the visible page - and you can simply search again without having to go through the shown matches as the next search starts after the current page. | |
C | Clear screen and rewrite page from top |
On some terminals scrolling is really s.l.o.w.. Rewriting the page on these terminals usually is a lot faster than scrolling. With this option the screen update usually is a lot faster. | |
i | ignore case in searches |
LESS will ignore the case of the letters in the search string. Thus I don't have to enter the exact word I am looking for, eg the search string "foo" will match on "foo", "Foo", "FOO", and "fOo". | |
M | shows even More info on the command line than more |
LESS will show more information on the file:
{path}/{file} line {topline}/{totallines} NN%With ^G you will get to see the byte count, too: {path}/{file} line {topline}/{totallines} byte {firstbyte}/{totalbytes} NN% |
|
s | squeeze blocks of empty lines |
A block of empty lines will be squeezed to only a single empty line. Useful for texts from people who usually enter lots of empty lines in succession... |
less 378 2002-09-30 ... ... less 330 1996-10-28
Note that the version number is really "378" - and not "3.7.8".
More or less, more or less, Count your fingers, have a guess, More or less, more or less, Find out if there's more or less from "Numbertime", a BBC Childrens' TV program about numerical increments and decrements.
URL: http://www.math.fu-berlin.de/~guckes/less/ Created: Mon Sep 30 00:00:00 MET 1996Send feedback on this page to