| previous | contents | up | next |
cat file1 file2 file3 > file4
cat can also be used in pipelines:
cat file1 file2 file3 | more
more has many options, allowing you, for instance, to read several files in a row. The most useful application of more, though, is to read one large piece of input, exactly as in the above example:
cat file1 file2 file3 | more
You can also simply more file1.
6.2.2.3. less
less is a more functional clone of more provided by the
GNU project (and named in that project's
punning tradition). One added feature of less is that it
allows you to scroll back and forth in a file one line at a time
with the arrow keys, rather than with alphabetical keys like h,
j, k, and l. less reads files
incrementally, rather than loading each file into memory like
more, so less uses less memory.
6.2.2.4. head
Sometimes you want to read only the first part of a file. This is
often true for files produced by the system logger, which
can be too large to open quickly in an editor. In this case,
the head command can be useful. head takes an
argument which specifies the number of lines to print:
head -12 /var/log/messages
If you need to see more lines of text than your terminal can display, more and a pipe can help you:
head -321 /var/mail/myusername | more
| previous | contents | up | next |