Chapter 12. Showing What’s in a File
Cracking the Nut
What Good Is a cat?
The cat command may well be the first command new users hear about, if only because of its odd name. cat stands for concatenate or, as some would say, catenate. Both words mean the same thing: to connect in a series. The cat command takes its filename arguments and strings their contents together. Essentially, cat takes its input and spits it out again.
cat has many uses, but the four most basic applications are described in the following list. In many ways, they don’t illustrate cat so much as they illustrate the shell’s output redirection (Section 43.1) mechanism.
First form:
%
catfile%catfile1 file2 file...Use this form to display one or more files on the screen. The output doesn’t pause when the screen is full. As a result, if your files are more than one screenful long, the output will whiz by without giving you a chance to read it. To read output by screenfuls, use a pager such as less (Section 12.3).[1]
Second form: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access