When more
is passed a file whose contents can be displayed on one screen, it just writes the file's contents to stdout without pagination. If the file cannot fit on one screen, more
paginates it.
less
has an option to quit if the file it is working with can be displayed on one screen (-F
) and it has a more
-emulation feature that behaves in a similar manner to the -F
flag, but neither of these options seems to cause less
to write the file's contents to stdout if the contents can fit on one screen.
How can I get less
to write a file's contents to stdout if the file's contents can fit on one screen and paginate the file as it normally would otherwise?
-F
only work with-X
? – Jesse Sep 02 '13 at 05:50-X
, just not as you expect. Since less is a pager that acts on the alternate screen in your terminal, if you don't disable the termcap initialisation, it will both start and quit on the alternate screen. You'll probably see a quick flash. – Chris Down Sep 02 '13 at 08:30echo lol | LESS=F less
because it prints on an alternate screen and immediately switches back? Makes sense I guess (although I don't see a quick flash). Thanks. – Jesse Sep 03 '13 at 00:01less -F
work without-X
. – John Mellor May 23 '15 at 19:07