How to make mouse wheel scroll the less pager using bash and gnome-terminal?

The computer where less scrolled had LESS=-r, the other had LESS=-asXFMMRqix8.

From the less man page:

-q or --quiet or --silent

      Causes moderately "quiet" operation: the terminal bell is not rung if an attempt is made to scroll past the end of the file or before the beginning of the file.  If the terminal has a "visual bell", it is used instead.  The bell will be rung on certain other errors, such as typing an invalid character.  The default is to ring the terminal bell in all such cases.

-X or --no-init

      Disables sending the termcap initialization and deinitialization strings to the terminal.  This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen.

The -X option prevented scrolling all together and the -q option caused the pager to enter a non-scrollable state when scrolling past the beginning or end of file.

My options are now LESS=-asrRix8.


For those who are as a newbie like me, you have to enter the following to your terminal:

export LESS=-r

or use this:

export LESS=-R

you can use man less to see the difference

To have the effect persist, you can add this line to your ~/.bashrc and reopen your terminal.


export LESS='--mouse --wheel-lines=3'