top | item 46465184

(no title)

JayGuerette | 1 month ago

Also -X or --no-init

" ... desirable if the deinitialization string does something unnecessary, like clearing the screen."

I prefer to not clear the screen. I usually want to continue to refer to something or even copy/paste from the content to my current command line.

discuss

order

Izkata|1 month ago

And combined with -E, it'll quit immediately if the output is smaller than the terminal size.

...And combined with some of the other options in the post, my go-to has been "less -SEXIER" for a long time. Specifying E twice doesn't seem to do anything except make this easier to remember.

jlokier|1 month ago

I recommend -FX instead of -EX. They both quit immediately if the output is smaller than the screen size, but -FX does not quit if the output is larger and you jump to the end of a large file, so you can continue to do things like scroll back or search.

git uses "less -FRX" by default. This is how I learned about -F.

(To be pedentic, git uses "LESS=FRX less", which accomplishes the same thing.)

kccqzy|1 month ago

I hate -E. Quitting immediately does not do good things to my muscle memory. I’m using to hitting q to quit less when I am done. Now the q key becomes part of the input to the shell prompt (or worse if there’s a different tool invoking less and now q might be interpreted differently by that tool). I value the consistency of user interaction more than saving a keystroke.

marcosdumay|1 month ago

I'm reading it correctly that it will cause less to exit if you scroll until the end of file even if the file is larger than the terminal size?