3.15. Listing the Contents of a File: cat/more/head/tailTo check the contents of the "heart" file that I had created in my home directory "/home/glass," I listed its contents to the screen using the cat utility. Notice that I supplied cat with the name of the file that I wanted to display: $ cat heart ...list the contents of the 'heart' file. I hear her breathing, I'm surrounded by the sound. Floating in this secret place, I never shall be found. $ _ cat can actually take any number of files as arguments, in which case they are listed together, one following the other. cat is good for listing small files, but doesn't pause between screens of output. The more utility is better suited for viewing larger files, because it provides advanced facilities such as the ability to scroll backward through a file. Figure 3-16 gives some notes on each utility.
While we're on the topic of listing files, there are a couple of handy utilities called head and tail that allow you to peek at the start and end of a file, respectively. Figures 3-17 and 3-18 describe how they work.
In the following example, I displayed the first two lines and last two lines of my "heart" file: $ head -2 heart ...list the first two lines I hear her breathing, I'm surrounded by the sound. $ tail -2 heart ...list the last two lines Floating in this secret place, I never shall be found. $ _ |