The Computer Oracle

Change less (pager) default options

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Melt

--

Chapters
00:00 Change Less (Pager) Default Options
00:47 Answer 1 Score 5
00:58 Accepted Answer Score 12
01:16 Answer 3 Score 1
01:37 Thank you

--

Full question
https://superuser.com/questions/174286/c...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#ubuntu #less #pager

#avk47



ACCEPTED ANSWER

Score 12


I found the answer somewhere else. I needed to use lesskey to set up less's options:

$ lesskey -
#env
LESS = -R

Then Ctrl+d

did the trick. I'm still not sure why less ignores $LESS though.




ANSWER 2

Score 5


Set the LESS environment variable to a space-separated list of your favorite options.




ANSWER 3

Score 1


The most likely issue is that you didn't export the less variable.

LESS="FRX"
ls -l | less
<not colorized>

export LESS="FRX"
ls -l | less
<colorized>

You could, for example, create a file called '/etc/profile.d/less.sh', with just 'export LESS="FRX"' in it, and your less configuration will be available system-wide.