Recently I've noticed that less command doesn't work.

$ ls | less                                                        
Engineering Software as a Service_ An Agile Approach Using Cloud Computing_B00CCEHNUM copy.azw3
postgresql-v400 2

As you can see it didn't open less as viewer. It might be some global setting but I have no idea what might it cause.


$ which less
$ echo $LESS                                                           
-F -g -i -M -R -S -w -X -z-4
less <somefile> - works as expected
  • 3
    Is LESS set in the shell? What does echo $LESS return? Does less some-text-file work as expected? – nohillside Jun 26 '16 at 14:46
  • Why are some parts of the output in blue?! – Nicolas Barbulesco Jun 26 '16 at 18:41
  • 2
    @NicolasBarbulesco That’s the Always Perfect™ default syntax highlighter. – J F Jun 26 '16 at 20:29

From man less:

   -F or --quit-if-one-screen
          Causes  less  to  automatically  exit  if  the entire file can be displayed on the first

Remove the option from LESS to avoid this.

  • 2
    Please point me to the documentation of 'echo $LESS', i've never heard of this expression. – megas Jun 26 '16 at 15:06
  • 3
    echo is a shell command which prints all its arguments (try echo Hello World). LESS is a variable defined in your shell which can be addressed as $LESS. Combining this together you can use echo $LESS to display the content of this variable. – nohillside Jun 26 '16 at 15:18
  • 1
    Why is the word “Causes” in blue? Strange. – Nicolas Barbulesco Jun 26 '16 at 18:44
  • 2
    @Nicolas Because it's the start of the line and the first letter is capital. The ‘default’ syntax highlighting style colours such text as blue. – grg Jun 26 '16 at 19:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .