Next 15.B: The cat Command  Up 15: File Utilities  Prev 15: File Utilities  Contents

Specialized

§ 15.A: Viewing Files with head


You may remember the tail command which we used to view the last few lines of files. The head command is similar, except that it is used to view the first few lines of a file. Go to the prog directory and try:
> cd development/prog/

> head area.f

Your response should look something like:

       PROGRAM area  
c area of circle, r input from terminal  
       DOUBLE PRECISION pi, r, A   
c    Best value of pi for IEEE floating point   
       pi = 3.14159265358979323846  
c       read r from standard input (terminal)  

       PROGRAM area  
c area of circle, r input from terminal  
       DOUBLE PRECISION pi, r, A   
Like tail you can specify the number of lines you wish to see using the option - followed by the number of lines. Try the command:
> head -5 area.f


Next 15.B: The cat Command  Up 15: File Utilities  Prev 15: File Utilities  Contents

Comments and questions to Dr. Elias N. Houstis at enh@cs.purdue.edu.