Displays the first few lines or bytes of a file or files.
head [ -Count | -c Number | -n Number ] [ File ... ]
The head command writes to standard output a specified number of lines or bytes of each of the specified files, or of the standard input. If no flag is specified with the head command, the first 10 lines are displayed by default. The File parameter specifies the names of the input files. An input file must be a text file. When more than one file is specified, the start of each file will look like the following:
==> filename <==
To display a set of short files, identifying each one, enter:
example% head -9999 filename1 filename2...
|-Count||Specifies the number of lines from the beginning of each specified file to be displayed. The Count variable must be a positive decimal integer. This flag is equivalent to the -n Number flag, but should not be used if portability is a consideration.|
|-c Number||Specifies the number of bytes to display. The Number variable must be a positive decimal integer.|
|-n Number||Specifies the number of lines from the beginning of each specified file to be displayed. The number variable must be a positive decimal integer. This flag is equivalent to the -Count flag.|
This command returns the following
|>0||An error occurred.|
To display the first five lines of the Test file, enter:
head -5 Test
head -n 5 Test
The tail command.
Files Overview in AIX 5L Version 5.1 System User's Guide: Operating System and Devices.
Input and Output Redirection Overview in AIX 5L Version 5.1 System User's Guide: Operating System and Devices.