Viewing the Contents of a File

To display the contents of a text file on screen, type:
    > cat  filename
 

If the file is too long and scrolls out of the shell, you can either use the scrollbar on the shell to read the text or type :
    >  more  filename
This will display the file one page at a time.  Press [space bar] to proceed to the next page, [Enter] to scroll down one line,  and [q] to quit.
 

To view the first ten lines of a file, type:
    > head filename
You may add an optional integer n to display the first n lines of the file.
For example, " > head -5 filename"  will display the first 5 lines of the file.
 

Similarly, to view the last ten lines of a file, type:
    > tail filename
You may again add an optional integer n to display the last n lines of the file.
 
 

©1998 Randal Leistikow. All Rights Reserved.
randal@ccrma.stanford.edu