linux 'more' and 'less'.

more(ref:more, less, and most)

more(1) is what we call a pager utility. Oftentimes the output of a particular command is too big to fit on one screen. The individual commands do not know how to fit their output to separate screens. They leave this job to the pager utility.

The more command breaks the output into individual screens and waits for you to press the space bar before continuing on to the next screen. Pressing the enter key will advance the output one line. Here is a good example:

% cd /usr/bin% ls -l

That should scroll for a while. To break up the output screen by screen, just pipe it through more:

% ls -l | more

That is the pipe character (shift backslash). The pipe is short for saying take the output of ls and feed it into more. You can pipe just about anything through the more command, not just ls. Piping is also covered in Section 8.2.3.

 

less

The more command is quite handy, but often you will find that you have advanced past the screen you wanted. more does not provide a way to go back. The less(1) command provides this functionality. It is used in the same way as the more command, so the previous examples apply here too. So, less is more than more. Joost Kremers puts it this way:

less is more, but more more than more is, so more is less less, so use more less if you want less more.

你可能感兴趣的:(linux)