4 ms·
Also -X or --no-init " ... desirable if the deinitialization string does something unnecessary, like clearing the screen." I prefer to not clear the screen.
by JayGuerette 9mo 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.
- Izkata 9mo agoAnd 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.
- marcosdumay 9mo agoI'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?
- Izkata 9mo agoYeah; in both cases (text is larger or smaller than terminal) it makes "less" act the same as "more" with auto-exiting.
- kccqzy 9mo agoI 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.
- jlokier 9mo agoI 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.)
- ilyagr 9mo agoIf you want the `-X` behavior only some of the time, see https://news.ycombinator.com/item?id=46472859 https://news.ycombinator.com/item?id=46472859. (Maybe I should've posted it in this thread)