New answers tagged less
from less manual, to scroll n lines at a time, but shows a whole screen-full. -[z]n or --window=n Changes the default scrolling window size to n lines. The default is one screenful. The z and w commands can also be used to change the window size. The "z" may be omitted for compatibility with some versions of more. If the number n is negative, it ...
less works with screens of text. The "screen" is the full size of the terminal. less --window=n can tell less to only use so many rows at a time. That being said the option is not always available. see man less If you only want "some" output try tail -n 20 /file.txt for the last 20 lines, or I personally use head -n 20 | tail -n 10 to get the middle 10 ...
Display a file from line number X: less +X filename Use the -N option to output line numbers e.g less +15000 -N filename displays from line number 15000 with line numbers displayed
Less reads its input lazily. When you start it, it only loads the beginning of the input (enough to fill one screen). As you scroll down, Less loads more and more. If you tell Less to move to the end of the input, it loads everything. If the input is a regular file, Less simply seeks to the end, but when the input is a pipe, there's no way to get to the end ...
This effect is mentioned in man page of less G or > or ESC-> Go to line N in the file, default the end of the file. (Warn‐ ing: this may be slow if N is large, or if N is not specified and standard input, rather than a file, is being read.)
To quit less, type q. Also, check out man less for some more, useful bits of information. In general, assuming man has been properly installed, man xyz will tell you how to use the xyz tool. man will normally display through less as well, so to exit from man, again you would type q.
I think you can exit by pressing Ctrl+C.
You're seeing output to the terminal while it is not in NLCR mode (stty -onlcr). Normally the kernel driver for ttys outputs a carriage return along with a newline whenever a newline is output. With NLCR mode disabled newlines are output as is, which moves the cursor down one line but leaves it in the same column. This produces the staggered output you ...
Not quite the answer you were looking for, but it might be a better one. mandb is an implementation of man that will format man pages in HTML. It was written by someone at Redhat and is I think now the standard on all .rpm based systems, but available to install as a replacement for the old man on Debian, Ubuntu, et. al. Using mandb, man -H whatever will ...
I doubt less has such an option. What you're doing is very similar to what tail -f achieves, only with convenient scrollback. What you can do is quit current less and re-launch it with tail -f logfile -n lines_back | less that way your buffer will contain only lines_back lines of the log (and should grow just the same).
Top 50 recent answers are included