6.1 Directory and File Management Using the Command Line
6.1.3 Displaying file contents with cat and more
Using the cat Command
The
cat (short for concatenate) command displays the contents of a text file on the screen. It is often used to display short text files such as script files (similar to batch files). Because cat flashes through the entire file rapidly without pausing, you should either be prepared to stop & start the scrolling with the Control-s and Control-q keys or use the more command (covered next). The cat command can also be used to concatenate (join) two or more files into one large file.
Command Format:
cat filename(s)

Figure shows the use of the cat command to display the dante text file in the /home/user2 directory. If the file fills more than one screen, the data scrolls off the screen - unless you are using a scrolling window, such as a terminal window, within the CDE environment.

Using the more Command
Use the
more command to display the contents of a text file one screen at a time. If the information in a file is longer than one screen, the following message appears at the bottom of the screen where n is the percentage of the file already displayed.

--More--(n%)

The on-line manual pages use the more utility for display purposes, so the scrolling keys in Figure are the same ones used to display man pages. Using cat or more to read executable or binary files can cause a terminal or window to hang and you would need to use Control-c to restore the shell prompt.

Command Format:
more filename(s)

At the --More-- prompt, you can use the keys in Figure to control the scrolling capabilities.

Interactive Media Activity (Flash, 95 kB)
  Using cat and more

In this media activity, you are logged in as user2 and your current working directory is: /home/user2. Refer to the Class File Tree Structure by clicking the 'tree' button located on the Menu Bar and type the commands that would accomplish the requested objectives. 
Note: Be sure to press enter after each one. Click on step 1 to begin.