Example of customising the less command

These examples show how the environment variable LESS is set; first by users of the C and TC shells and then by users of the Bourne and BASH shells.


C shell / TC shell

To display the size of the file in the prompt:

   setenv LESS -P%B

or:

   LESS=-P;export LESS

This displays the size (in bytes) of the file being displayed.


Bourne shell / BASH

To change the prompt and the way that text is displayed:

   setenv LESS '-N -S -P%f'

or:

   LESS='-N -S -P%f';export LESS

This puts the filename in the prompt (-P%f), displays the number of each line in the file (-N) and truncates lines that are too long to be displayed on the screen so that they do not wrap onto the next line (-S).

Check the manual page for a full list of all the options that are available.


[Home] [Search] [Index]