If I have LESS='-FRX' as a default environment variable, how can I, as an exception to the rule, run less with only -R, ie. override/nullify -FX?


The options specified in LESS can be overridden by options on the command line. You can't however prevent less from using the options in LESS that you don't explicitly override without changing this variable.

One way to run less with a (temporarily) modified value of LESS would be to use

LESS= less -R filename

This would call less -R with an empty value in LESS.


LESS=-R less filename

which would call less with LESS set to -R only.

  • Nice! This is quite an acceptable solution!
    – forthrin
    Feb 2 '19 at 12:03
  • @Kusalananda is -+ a recent feature? - see my answer below
    – laktak
    Sep 25 '20 at 19:16
  • 1
    @laktak It's not a recent feature. The variant of less that I've been using (on OpenBSD) has had that since at least 2003.
    – Kusalananda
    Sep 25 '20 at 21:05

If you have defined LESS='-FRX' you can override/disable the FX options with

less -+FX

This is listed in the less man page:

The environment variable is parsed before the command line, so command line options override the LESS environment variable. If an option appears in the LESS variable, it can be reset to its default value on the command line by beginning the command line option with "-+".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.