sdjf > commands > less

The less Command

The "less" command is similar to the "more" command, but much more powerful and efficient to use on the Zaurus and other Linux systems.

While both commands display the contents of a file, one screenful at a time, "less" enables the user to skip to the beginning of a file with "g", skip to the end of the file with "G", to search for a keyword or phrase "/KEYWORD", view the previous file with ":p", view the next file with ":n", and many, many more things that we are unable to do with "more".

The syntax for using "less" is similar to the syntax for using the "cat" command. You can view just one file:

less myfile

Or you can view a set of files:

less file1 file2 file3 file4

Or a set of all files matching a specifed pattern:

less file*

You can view a list of all the options and commands that "less" has by simply entering "less --help" from the command line, or the letter "h" from within "less".

You can go to the next screen by pressing the space bar, the same as with "more." But if you want to go back a screen, just enter a "w" for "window" and it will scroll up one screen. To exit "less", simply enter a "q" for "quit".

I had difficulty figuring out how to use "less" to view the next or the previous file. Since the command prompt inside of "less" is a colon ":", how to invoke this feature was not at all obvious.

So, here are some hints about how to view the next file or the previous file, when you have given "less" a list of files to open. After you see the prompt, you must enter a colon ":", followed by the letter "p" to view the previous file, or followed by the letter "n" to view the next file.

If you pay close attention before you enter any commands, you will notice that the command prompt ":" in "less" appears in the first column of the status line.

1st column

Then, when you enter a colon ":", the command prompt colon will disappear, and the colon you have entered will appear in the second column on your screen.

 2nd column

When you enter ":n" or ":p", the command you enter will not appear. Instead, navigation information will appear in the status line.

For example, if I am reading the second file (trial2.html) in a set of eight files, and want to look at the next file, trial3.html, and then go back to look at the second file again, trial2.html, I would do the following:

Enter the ":f" command to show the name of the current file:
My status bar will display:
 trial2.html (file 2 of 8) line 1/67 byte 400/743 53% (press RETURN)
When I am done viewing this file for now, I can enter the ":n" command for next file:
My status bar will display:
 trial3.html (file 3 of 8)
When I am done viewing the current file for now, I can enter the ":p" command for previous file:
My status bar will display:
 trial2.html (file 2 of 8)

"Less" has many more useful features than I have had time to explore or to figure out how to use. I will add tips about how to use more of it's features as I have the time and/or get them figured out.

I extracted the copy of "less" that I am running on my Zaurus, from the arm utilities package, available at:

You can get a gzipped copy of the "less" binary I am using on both my sl5500, on Sharp ROM 2.38, as well as on my sl6000L, running Sharp ROM 1.12,, at:
bash-2.05# md5sum less.gz
b32dc09387f29d20f40712b0a4742691 less.gz

There also appears to be an ipk on the following feeds, but I do not know which ROMs it will work on: It seems likely to work on Sharp ROMs, but I cannot guarantee it.

It may be a copy of the less_1.0_arm.ipk compiled for arm devices, which is described at:

It depends on,, and on In case your ROM does not include, I have put a gzipped copy of the latter at:

The above version of will need to be gunzipped before use. It runs on both my Collie with Sharp ROM 1.38 and on my Tosa Sharp ROM 1.12. Some applications require the library to be called instead of, you can just create a symlink to achieve equivalence. If you run the following, packages looking for will be satisfied to use

ln -s /home/QtPalmtop/lib/ /home/QtPalmtop/lib/

The library can also be obtained from the arm utilities package mentioned above.

Revised December 6, 2012