What do you think? Discuss, post comments, or ask questions at the end of this article [More about me]

Problem

I love Linux 'less' (perhaps even more than nano...).  I almost always run 'less' with the -S flag (which does not wrap text passed the screen width).

This guide shows how you can set default options (per user) for 'less'.

Solution

You'll need to first create an .lesskey file in your user folder. Note, if you use sudo less, you'll need to create a .lesskey file in /root.

In your user folder, do

nano .lesskey

and add the following text:

#env
LESS = -S

add any options you would like (in the above example I've just added the '-S' option).

You'll now need to run the code below to activate the default options.

lesskey

References

  1. https://ascending.wordpress.com/2011/02/11/unix-tip-make-less-more-friendly/