Go to the first, previous, next, last section, table of contents.


If you are using Object REXX (the DEVCON 8/9 edition), the "=" command will be disabled, as well as "external" commands. The first point is due to a definition change in the STREAM() built-in function, and will be fixed in a future release of Less, but the second point is due to a bug in the LINEIN('CON:') built-in function, and will not be fixed by Less.

What's That?

Less is a file browser. When used as a MORE.EXE replacement, it provides much faster displays, the ability to run any program/command and some information (the elapsed number of lines, mainly).

When used as a command, it provides horizontal and vertical scrolling, the ability to locate a text string, to jump to a specified line... and it can cycles through more than one file.

And less.cmd is small (less than 2Kb). But if you are new to REXX, this command file is not necessarily the best place to start with, though :-) [It is nicely indented - to my taste - but there is not that much comments, and it includes some cryptic statements...]


Installing Less is very simple: just copy LESS.CMD somewhere along your PATH.

Starting Less


   less filename [filename ...]
   ... | less
   less <...


   less *.doc *.txt
   dir | less
   less <config.sys


[A "*" following a command name denotes a command which cannot be used when less.cmd is called as a filter.]

"<", Left (*)
Scroll right 20 columns.
">", Right (*)
Scroll left 20 columns.
"N", F12 (*)
Next file in the ring (if available).
"P", F11 (*)
Previous file in the ring (if available).
"." (*)
Redraws the screen.
Exits less.
Scroll down one line.
SPACE, PageDown
Move down one screen.
Move up one screen.
+nnn (*)
-nnn (*)
nnn (*)
Use this command to move the current (top) line to another one. It can be used in three ways:
   nnn      Move to line number nnn.
   +nnn     Move forward (down) nnn number of lines.
   -nnn     Move backward (up) nnn number of lines.
Displays current file information: file name, current top line number, current left column, current position, file size and file position in the file ring.


   <D:\backup\config.new line=1 col=1 pos=1142/3905 file=1/4>
/[searchstring] (*)
Locates the first occurrence of "searchstring" in the current file. If "searchstring" is empty, locates the next occurrence of the previously defined searchstring.

The search is case-insensitive.



The top-line will be positioned on the first occurrence of "REM" in the current file. If nothing is found, you will get a new less ":" prompt, as in:


The top-line will be positioned on the next occurrence of the previously defined searchstring (REM in our example).

If no next occurrence exists, you will get a new less ":" prompt, as in:

anything else
Your REXX command is interpreted.

Warning: When calling a REXX script, you have to precede its name with "call ".

The following internal variables may be of interest:

   A        the command line arguments
   file     the current file name
   r        the screen height
   c        the screen width
   l        the current top-line number
   d        the current horizontal delta
   n        the current file position in the ring
   m        the number of file in the ring
   t.i      (where i is in 1..m) the ith file name
   s        the current search string


To display the current directory, enter


[If you want to use jokers chars, you will have to use single or double quotes, as in: dir "*.cmd".]

To display the current search string, enter

   say s

To edit the currently displayed file with tedit, enter

   call exc close; tedit file

and use the "." command to redraw the screen.

[Well, the "call exc close" is not very, er, intuitive, but it is required in order to prevent a file-sharing violation -- that is, less is currently reading the file, and so, nobody can change it. Automatically closing the file may be implemented in a future release, though...]

Known Limitations

All theses limitations can easily be fixed, but the 2Kb figure please me very well, so, I will try to include them without breaking it... That unfortunately takes a bit more time :-)
Go to the first, previous, next, last section, table of contents.